There are various FFmpeg encoders that support variable bit rate / constant quality encoding (learn more about rate control modes here). This gives you a much better overall quality when file size or average bit rate are not constrained (e.g. in a streaming scenario). Variable bit rate is usually achieved by setting
-q:a for audio) instead of
-b:a), which just sets a constant bit rate.
The problem is that every encoder uses a different range of values to set the quality—and they’re hard to memorize. This is an attempt to summarize the most important ones.
Notes for reading this table:
- Qmin stands for the setting to be used for achieving lowest quality and Qmax for highest. These are not just lowest and highest values.
- Qdef is the default value chosen if no other is specified. This means that (most?) encoders will use one or the other VBR mode by default, e.g. libx264. I wasn’t able to research whether this applies to all encoders.
- Some encoders use private options instead of the regular
-q. Read the second column Param for the correct option to use.
- Rows highlighted with green refer to encoders that allow you to use VBR. Rows in yellow aren’t really VBR or I simply couldn’t find out whether they support it. Rows in red mean: No VBR support.
||51||0||23||18–28||Values of ±6 result in double/half avg. bitrate. 0 is lossless.
||51||0||28||24–34||Values of ±6 result in double/half avg. bitrate. 0 is lossless.
||31||1||n/a||3–5||2 is visually lossless. Doubling the value results in half the bitrate. Don't use 1, as it wastes space.
No VBR by default—it uses
||0||10||n/a||7||No VBR by default—it uses
|mpeg1, mpeg2, mpeg4, flv, h263, h263+, msmpeg+||
||31||1||?||3–5||2 is visually lossless. Doubling the value results in half the bitrate.
||0||3||2||Depends||Not VBR. Corresponds to the profiles Proxy, LT, Std, HQ.
ProRes might support
Target bitrates are in the ProRes Whitepaper.
||1||5||?||4 (~128kbps)||Currently the highest quality encoder.|
||10||500||100||100 (~120kbps)||A good quality encoder.|
||0||10||3||4 (~128kbps)||Make sure not to use
||9||0||4||2 (~190kbps)||Corresponds to
||0.1||?||?||0.12 (~128kbps)||Undocumented setting, use with caution.|
||?||?||?||?||You need to set
|libaacplus||VBR not available?|
|libvo_aacenc||VBR not available.
Not supported in ffmpeg anymore.