VideoHelp Forum




+ Reply to Thread
Results 1 to 14 of 14
  1. Hi folks,

    We use ffmpeg to encode files for online streaming. But since I want a really good image quality, I'm facing a huge problem, the video is jerky while streaming, even if it's 100% buffered, but if we play the file with vlc from the computer all is good.

    My goal is to have the best image quality as possible (pretty close/or same as the source), but staying around 15megs/minute ratio, and that the streaming is fluid and not using up the computer resources of who is watching it.

    Actually I use this command line :

    ffmpeg -i SOURCE_FILE -deinterlace -s 960x540 -aspect 16:9 -acodec libfaac -ac 2 -ar 44100 -ab 128k -vcodec libx264 -vpre medium_firstpass -vb 2200k -pass 1 -f rawvideo -y /dev/null

    ffmpeg -i SOURCE_FILE -deinterlace -s 960x540 -aspect 16:9 -acodec libfaac -ac 2 -ar 44100 -ab 128k -vcodec libx264 -vpre medium -vb 2200k -pass 2 -f mp4 -y OUTPUT.mp4

    MP4Box -inter 500 OUTPUT.mp4
    The medium_firstpass preset contains :

    coder=1
    flags=+loop
    cmp=+chroma
    partitions=-parti8x8-parti4x4-partp8x8-partb8x8
    me_method=dia
    subq=2
    me_range=16
    g=250
    keyint_min=25
    sc_threshold=40
    i_qfactor=0.71
    b_strategy=1
    qcomp=0.6
    qmin=10
    qmax=51
    qdiff=4
    bf=3
    refs=1
    directpred=1
    trellis=0
    flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip
    wpredp=2
    And the medium preset contains :

    coder=1
    flags=+loop
    cmp=+chroma
    partitions=+parti8x8+parti4x4+partp8x8+partb8x8
    me_method=hex
    subq=7
    me_range=16
    g=250
    keyint_min=25
    sc_threshold=40
    i_qfactor=0.71
    b_strategy=1
    qcomp=0.6
    qmin=10
    qmax=51
    qdiff=4
    bf=3
    refs=3
    directpred=1
    trellis=1
    flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip
    wpredp=2
    Your help will be very appreciated, I'll watch this thread often to answer your questions rapidly.

    Best regards,
    Raphael
    Quote Quote  
  2. Member bat999's Avatar
    Join Date
    Feb 2008
    Location
    United Kingdom
    Search Comp PM
    ..........
    Last edited by bat999; 22nd Oct 2011 at 07:25.
    Quote Quote  
  3. Member
    Join Date
    Oct 2010
    Location
    England
    Search Comp PM
    Originally Posted by iwiiiiiiiiii View Post
    We use ffmpeg to encode files for online streaming. But since I want a really good image quality, I'm facing a huge problem, the video is jerky while streaming, even if it's 100% buffered, but if we play the file with vlc from the computer all is good.
    Some more info needed:
    - What's the spec of the computer you're using?
    - What video player are you using for the streaming video?
    - Browser, Flash version, graphics card?
    Quote Quote  
  4. Hi intracube

    Basically the website where the videos are streamed is a big european website, so there's thousand of difference users that come to watch the videos. All videos are encoded on debian servers, running x264 & ffmpeg last version.

    The flash player we use to stream the videos, is a one we developed, and all mp4 files are stored on the big cdn of limelight networks.

    We started to have issues when we have increased the video quality. If I drop the -vb to 1000 instead of 2200, obviously it gets better, but the image quality is terrible.

    On freenode on #x264, somebody told me to remove the b-frames, which did not helped. I also disabled CABAC, which did not helped to.

    Now I'm going to try to encode the h264 files from x264 instead of ffmpeg, but if you guys have ideas, I would really appreciate it before I jump by the window !
    Quote Quote  
  5. Try something like:

    x264.exe --preset=veryfast --crf 18 --ref 3 --bframes 2 --sar 1:1 --output %1.mp4 %1
    Obviously adjust the CRF value to your liking, or bitrate if using 2-pass encoding. And SAR to match your source.
    Quote Quote  
  6. Ok thanks, I'll try in the next hour
    Quote Quote  
  7. I'll have to play with it, I'm getting coloured snow instead of the video (see attachment)

    I used this command :


    x264 --preset=veryfast --ref 3 --bframes 2 --sar 1:1 --output output.mp4 input.mpg --input-res 960x540

    raw [info]: 960x540p 1:1 @ 25/1 fps (cfr)
    x264 [info]: using SAR=1/1
    x264 [info]: using cpu capabilities: MMX2 SSE2Slow SlowCTZ
    x264 [info]: profile High, level 3.1
    x264 [info]: frame I:1 Avg QP:35.00 size:312251
    x264 [info]: frame P:56 Avg QP:35.00 size:318964
    x264 [info]: mb I I16..4: 23.1% 37.3% 39.6%
    x264 [info]: mb P I16..4: 28.4% 39.6% 28.4% P16..4: 0.1% 0.5% 2.9% 0.0% 0.0% skip: 0.0%
    x264 [info]: 8x8 transform intra:41.0% inter:19.9%
    x264 [info]: coded y,uvDC,uvAC intra: 100.0% 100.0% 100.0% inter: 100.0% 100.0% 100.0%
    x264 [info]: i16 v,h,dc,p: 0% 0% 95% 4%
    x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 3% 4% 64% 4% 6% 4% 4% 4% 5%
    x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 6% 5% 40% 6% 13% 7% 8% 6% 8%
    x264 [info]: i8c dc,h,v,p: 92% 0% 0% 8%
    x264 [info]: Weighted P-Frames: Y:1.8% UV:1.8%
    x264 [info]: ref P L0: 39.3% 30.5% 30.2%
    x264 [info]: kb/s:63769.33

    encoded 57 frames, 44.53 fps, 63771.79 kb/s
    Image Attached Images  
    Quote Quote  
  8. If you're getting that as ouput that must be what x264 is getting as input. Something must be going wrong with the MPG decoding. With MPEG 2 sources I recommend you use DgIndex to build and index file (.d2v) and Mpeg2Source("filename.d2v") in an AviSynth script to feed x264.
    Quote Quote  
  9. Member
    Join Date
    Oct 2010
    Location
    England
    Search Comp PM
    Originally Posted by iwiiiiiiiiii View Post
    The flash player we use to stream the videos, is a one we developed, and all mp4 files are stored on the big cdn of limelight networks.

    We started to have issues when we have increased the video quality. If I drop the -vb to 1000 instead of 2200, obviously it gets better, but the image quality is terrible.
    Have you tried other Flash players like Flowplayer or JW Player? If you get smooth playback with them, it would suggest your in house developed Flash player needs looking at. But if you get the same stuttering, it could be an encoding issue.

    What web browser are you using, and have you tried any others? Is Flash up to date? System spec, etc?
    Quote Quote  
  10. Hi Intracube,

    I'm thinking to have the developers look into the player now after the 50 tests I did... My observation is that the cpu usage is an issue. Before with that player, at 1000k rate it was not rushing the computer, but obviously it was so low quality.

    The issue seem to happen on any flash version and browser.
    Quote Quote  
  11. Just did a test by reducing the resolution of the -s variable at the same quality and the cpu dropped by 30%.

    So my question is, do I have a potential solution to follow or it's just simply normal ?
    Quote Quote  
  12. Member
    Join Date
    Oct 2010
    Location
    England
    Search Comp PM
    Originally Posted by iwiiiiiiiiii View Post
    I'm thinking to have the developers look into the player now after the 50 tests I did... My observation is that the cpu usage is an issue. Before with that player, at 1000k rate it was not rushing the computer, but obviously it was so low quality..
    I've just done a test encode with ffmpeg using the same bitrate, x264 preset, resolution, and played it back with the JW Player without any stuttering. My CPU usage stayed around 45%. This was with Firefox 7.0.1, Flash 11.0.1.152 and an ancient (and low spec) Nvidia graphics card on Linux.

    Originally Posted by iwiiiiiiiiii View Post
    Just did a test by reducing the resolution of the -s variable at the same quality and the cpu dropped by 30%.

    So my question is, do I have a potential solution to follow or it's just simply normal ?
    By doing that you're dropping the resolution of the video which would be a workaround. The real issue is figuring out why your flash player is thrashing the CPU.
    Quote Quote  
  13. ok thank you so much intracube. If you want I can give you the link of many test I did, but you have to know it's 18plus content, if you want to see send me a prive message.

    Thanks again
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!