Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to transcode a video to H.264/MP4. I am using the crf = 20 option but according to the requirements I also want to limit the maximum bitrate to 3 MBit/s.

I was trying to cheat though it by using x264opts like this

-x264opts crf=20:vbv-bufsize=14000:vbv-maxrate=3000:keyint=40

is that the right way to do this? Can this be done or I am stuck with using a contant bitrate and no CRF?

share|improve this question

Use -maxrate and -bufsize to force the VBV (Video Buffer Verifier) to constrain the output bitrate:

ffmpeg -i input.file -c:v libx264 -crf 20 -maxrate 3M -bufsize 6M output.mp4

3M = 3 mbit/s, you could also use 3000k (for 3000 kbit/s). Set the buffer size according to how much you expect your client to be able to buffer.

See this guide for more information on using x264 with FFmpeg (although it doesn't mention VBV encoding).

share|improve this answer
@mark4o I'm certain it doesn't work. I've tested a low CRF and always get higher bitrates than the -maxrate. -maxrate is only used when -bufsize is set. In that case x264 uses VBV encoding and correctly constraints the bitrate. – slhck Mar 2 '13 at 8:58
The buffer size of the client is 2MB = 14000 kbits, that's why I chose that value. It seems like that the crf overrides the max bitrate constraint. Moreover is there a relationship between optimal maxbitrate and bufsize if the vbv encoding is used? – user1963939 Mar 4 '13 at 17:29
the most optimal is to use CRF mode without any additional constraints. – Sarge Borsch Nov 18 '14 at 19:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .