Arete
Arete

Reputation: 1004

How to use constrained/capped bit rate mode in FFmpeg

I used FFmpeg with this command to convert a video:

ffmpeg -i input -c:v libx264 -x264-params opencl=true -preset veryslow -crf 19 -maxrate 7000k -profile:v high -level 4.0 -bf 2 -coder 1 -pix_fmt yuv420p -c:a copy output.mkv

Note that I set -maxrate 7000k to set the maximum bit rate for the video. Still, the end result video has a maximum bit rate of 38.0 Mb/s.

Here are the results before (to the left) and after (to the right), if that helps.

Am I using maxrate properly? Should not the video be capped at 7000 kb/s?

Upvotes: 1

Views: 1190

Answers (1)

Gyan
Gyan

Reputation: 93339

maxrate is enforced via the bufsize option. No bufsize, no enforcement. See https://stackoverflow.com/a/33612662

The smaller the bufsize relative to maxrate, closer the actual peak bitrate to maxrate, but expect transient quality dips (if maxrate is too low for desired quality).

Start with

-maxrate 7000k -bufsize 7000k

Upvotes: 2

Related Questions