1

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?

Arete
  • 948
  • 3
  • 21
  • 48

1 Answers1

2

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
Gyan
  • 85,394
  • 9
  • 169
  • 201
  • Thanks. This might be the correct answer, I have no way to tell. I read your comment and I didn't really comprehend the second paragraph. I also read the other link you posted, but I feel like at this point I am lacking basic knowledge about what buffer really is, and how to combine it with max rate. I know the other post was quite elaborate, but I still don't really understand it. If you know something I can read up on, please let me know. Or if you want you could try to elaborate a bit more on the answer. – Arete Apr 09 '21 at 12:30
  • 1
    If bufsize isn't set, maxrate has no effect. bufsize tells the encoder what the size of the player's buffer is. Once the encoder knows that, it can control the maximum rate at which that buffer can be filled. Smaller the buffer, the tighter the control over peak bitrate. – Gyan Apr 09 '21 at 13:39