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 :
The medium_firstpass preset contains :
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
And the medium preset contains :coder=1
Your help will be very appreciated, I'll watch this thread often to answer your questions rapidly.coder=1
+ Reply to Thread
Results 1 to 14 of 14
Last edited by bat999; 22nd Oct 2011 at 07:25.
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 !
Try something like:
x264.exe --preset=veryfast --crf 18 --ref 3 --bframes 2 --sar 1:1 --output %1.mp4 %1
Ok thanks, I'll try in the next hour
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
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?
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.
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 ?
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 220.127.116.11 and an ancient (and low spec) Nvidia graphics card on Linux.
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.