We use ffmpeg and a transcoding script for transcoding and want to make some batch files which we can use for transcoding.

For example I use a parameter called video_kbit and if I am writing in 30000 it should reach 30 Mbit. Of course if I use 6000 as parameter it should reach 6 MBit as well, so I have one script which reaches every video bitrate I want.

As my settings are now, I only reach 18.1 Mbit. Only when I use 15000 as a parameter I am reaching my goal for a constant video bitrate of 15 MBit. If I use 8000 as parameter I get 10.1 MBit as a result. So under 15000, I get a higher bitrate and over 15000, I get a lower bitrate than I want.

My presettings are:

ffmpeg -threads "4" -i "$2"  -f mp4 -c:v libx264 -crf 1 \
-bufsize 30000k -maxrate ${FC_PARAM_video_kbit}k \
-acodec libfaac -ac 2 -ab ${FC_PARAM_audio_kbit}k -ar 44100 \
-pix_fmt yuv420p -vf scale=${FC_PARAM_width}:${FC_PARAM_height} -y "$3"

And I am using these parameters:

FC_PARAM_video_kbit = 30000
FC_PARAM_audio_kbit = 192
FC_PARAM_width = 1920
FC_PARAM_height = 1080

I have tried using a higher bufsize and using profile:v and level settings, but nothing got me near the constant video bitrate of 30000 Mbit.

Do you guys have any ideas or suggestions for a better way to reach my goal?

1 Answer 1


Setting the CRF (a constant quality mode) and a video bit rate at the same time does not make any sense. You want either of those, exclusively.

To achieve fixed bit rate, you must set minrate, maxrate and b:v to the same value. Your script would look something like this (but ideally you'd change bufsize as well):

ffmpeg -threads "4" -i "$2" -c:v libx264 \
-bufsize 30000k -maxrate ${FC_PARAM_video_kbit}k \
-minrate ${FC_PARAM_video_kbit}k -b:v ${FC_PARAM_video_kbit}k \
-c:a libfaac -ac 2 -b:a ${FC_PARAM_audio_kbit}k -ar 44100 \
-pix_fmt yuv420p -filter:v scale=${FC_PARAM_width}:${FC_PARAM_height} -y "$3"

But then again, does this make sense? The question is what you really need to achieve. There's rarely a point in forcing a high bit rate when it does not deliver any better visual quality (and only bigger file sizes). Wanting 30 MBit/s for x264 video – even if it's 1080p HD content – seems a bit like overkill to me.*

x264 is great at delivering really good quality if you just set a CRF low enough. Anything below 17 or 18 should be unnoticeable in terms of visual distortion, and a CRF of 0 means lossless encoding. Rather set the CRF to a value that looks good enough for you and don't worry about the bit rate. It's really meant as a set-and-forget type of option that you can apply to batches of video to achieve a similar quality output.

Lastly, don't forget that if, say, a second of video can be compressed losslessly (i.e. with CRF 0) into only 10 MBits, then setting the bit rate to 30 MBit/s will not force this part of the video to actually consume 30 MBit. x264 does not "create" information just to bloat the output to a requested bit rate. It will stay at 10 MBit.

* If you want to archive, or distribute the video for further processing, choose an intermediate codec like ProRes or DNxHD.

  • First of all I want to thank you for your fast answer. I have asked my coworker about this and we know that you can archieve higher bitrates by using DNxHD and ProRes, but our goal stays the same that we want to reach a specific targetbitrate, so if our clients want a clip with 6MBit they should get a clip with a constant bitrate of 6MBit. Some presets should be reached (for example screen resolution, codec container, video / audio bitrate and so on). Thats why I have asked of a way to reach at least a constant video bitrate, with your solution I reach a constant bitrate until 7MBit.
    – sebastian
    Commented Oct 23, 2013 at 10:35
  • I see. The thing is, really, that x264 wasn't written with a lot of support for CBR. The highest bitrate you can get is determined by what a CRF of 0 gives you. You cannot artificially get a higher bitrate, and it wouldn't result in better quality, so if you need x264, the only solution I see is to tell your clients that a higher bitrate might not be available (which isn't a bad thing though).
    – slhck
    Commented Oct 23, 2013 at 10:43
  • Once again thank you and we will use the CRF 0 option and go with the highest bitrate CRF 0 can give us.
    – sebastian
    Commented Oct 24, 2013 at 7:16

You must log in to answer this question.

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