Log in

View Full Version : Encoding at constant bitrate with ffmpeg


sameersbn
21st February 2011, 21:56
Hello,

I have installed the latest git version of ffmpeg and x264 (and other supporting libraries). I am trying to encode a file so that i can stream it over http. I wanted to get the video bitrate at 800kbps. For this is performed a two pass encode using ffmpeg:

ffmpeg -i sample.m4v -vcodec libx264 -vpre medium_slowfirstpass -b 800k -an -pass 1 -threads 0 -f matroska /dev/null
ffmpeg -i sample.m4v -vcodec libx264 -vpre medium -b 800k -an -pass 2 -threads 0 -f matroska sample.mkv

What i have noticed is that the bitrate of the encoded video is not 800kbps, but rather varies over the entire file. Meaning certain part of the file maybe a lower bitrates while other parts may be well over 1300kbps.

It seems that variable bitrate is being used and the bitrate is adjusted over the entire duration of the file. I would like the file to be converted strictly at 800kb per second and never go higher .

This is important for me since i want to stream the file over http. I have been trying in ffmpeg to get this working, but so far no luck.

Please help!

Thanks and Regards
~Sameer

sneaker_ger
21st February 2011, 22:55
http://mewiki.project357.com/wiki/X264_Encoding_Suggestions#VBV_Encoding
In ffmpeg these options are exposed as "-maxrate" and "-bufsize".