views:

169

answers:

1

I'm dealing with a very big issue about bit rate , ffmpeg provide the -b option for the bit rate and for adjustment it provide -minrate and -maxrate, -bufsize but it don't work proper. If i'm giving 256kbps at -b option , when the trans-coding finishes , it provide the 380kbps. How can we achieve the constant bit rate using ffmpeg. If their is +-10Kb it's adjustable. but the video bit rate always exceed by 50-100 kbps.

I'm using following command

ffmpeg -i "demo.avs" -vcodec libx264 -s 320x240 -aspect 4:3 -r 15 -b 256kb \ 
  -minrate 200kb -maxrate 280kb -bufsize 256kb -acodec libmp3lame -ac 2    \
  -ar 22050 -ab 64kb -y "output.mp4"

When trans-coding is done, the Media Info show overall bit rate 440kb (it should be 320kb).

Is their something wrong in the command. Or i have to use some other parameter? Plz provide your suggestion its very important.

+1  A: 

Those options don't do what you think they do. From the FFmpeg FAQ:

3.18 FFmpeg does not adhere to the -maxrate setting, some frames are bigger than
     maxrate/fps.

          Read the MPEG spec about video buffer verifier.

3.19 I want CBR, but no matter what I do frame sizes differ.

          You do not understand what CBR is, please read the MPEG spec. Read 
          about video buffer verifier and constant bitrate. The one sentence 
          summary is that there is a buffer and the input rate is constant, the
          output can vary as needed.

Let me highlight a sentance for you:

The one sentence summary is that there is a buffer and the input rate is constant, the output can vary as needed.

That means, in essence that the -maxrate and other settings don't control the output stream rate like you thought they did.

Stu Thompson