bitrate

Why does ffmpeg completely ignore my -b:v bitrate flag?


Running on MacOS.

I am trying to specify a bitrate using the -b:v flag in FFMPEG, but it seems to be completely ignored in the output file.

The command I am running is:

./ffmpeg -i ./input.mov -c:v prores_ks -b:v 9999M output.mov

Properties of input file:

Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf58.29.100
  Duration: 00:00:02.00, start: 0.000000, bitrate: 135708 kb/s
  Stream #0:0[0x1]: Video: prores (XQ) (ap4x / 0x78347061), yuv444p12le(progressive), 720x486, 135636 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : FFMP
      encoder         : Lavc58.54.100 prores_ks

Properties of output file:

Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf60.15.100
  Duration: 00:00:02.00, start: 0.000000, bitrate: 81747 kb/s
  Stream #0:0[0x1]: Video: prores (4444) (ap4h / 0x68347061), yuv444p12le(progressive), 659x445, 81743 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : FFMP
      encoder         : Lavc60.30.102 prores_ks

Note the bitrate of the output file is 81747 kb/s. It is always 81747 kb/s regardless of what I put in the -b:v flag.

I cannot understand why.

There is no audio stream, so I don't think an audio stream is affecting it at all.

All help greatly appreciated.


Solution

  • The "prores_ks" encoder does not have a programmable bitrate, or at least it does not respond to the -bitrate parameter. Instead, it uses the quality parameter, from -qscale:v. Experiment to find the best value for you.

    https://trac.ffmpeg.org/wiki/Encode/VFX

    Quoting:

    The options used here are standard and are explained in other documents, but let's elaborate a little bit more on the qscale paramater. This parameter determines the quality of the resulting prores movie - both the resulting size and bitrate. 0 means best and it goes up to 32 which is worst. From empirical testing we've found that a qscale of 9 - 13 gives a good result without exploding the space needed too much. 11 would be a good bet, 9 if a slightly better quality is required. When space is not a problem, go with qscale 5 or less, but approaching zero the resulting clip will be extremely large and the bitrate will be so high that it will stop being playable on normal equipment. `