FFmpeg VBR Settings
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:v (or -q:a for audio) instead of -b:v (or -b:a), which just sets a target 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.
| Encoder | Param | Qmin | Qmax | Qdef | Recommended | Notes |
|---|---|---|---|---|---|---|
libx264 |
-crf |
51 | 0 | 23 | 18–28 | Values of ±6 result in double/half avg. bitrate. 0 is lossless. Specifying -profile:v lets you adjust coding efficiency. See H.264 Encoding Guide.
|
libx265 |
-crf |
51 | 0 | 28 | 24–34 | Values of ±6 result in double/half avg. bitrate. 0 is lossless. Specifying -profile:v lets you adjust coding efficiency. See H.265 Encoding Guide and x265 docs.
|
libvpx-vp9 |
-crf |
63 | 0 | 31 (1080p) | 15–35 |
Recommended CRF 31 for 1080p HD. Use -b:v 0 for pure CRF mode. Two-pass encoding recommended for best quality. See VP9 Encoding Guide. |
libaom-av1 |
-crf |
63 | 0 | n/a | 20–35 | 0 is lossless. CRF 23 is roughly equivalent to x264 CRF 19. Slower than other encoders but excellent compression. See AV1 Encoding Guide. |
libsvtav1 |
-crf |
63 | 0 | 35 | 20–40 | Much faster than libaom-av1 with similar quality. Use -preset (0–13) to control speed/quality tradeoff. See AV1 Encoding Guide.
|
h264_videotoolbox |
-q:v |
1 | 100 | n/a | 70–85 | macOS hardware encoder. Scale 1–100, with 100 being highest quality. Constant quality only available on Apple Silicon (ffmpeg 4.4+). Also supports -b:v for bitrate mode.
|
hevc_videotoolbox |
-q:v |
1 | 100 | n/a | 70–85 | macOS hardware HEVC encoder. Scale 1–100, with 100 being highest quality. Constant quality only available on Apple Silicon (ffmpeg 4.4+). Also supports -b:v for bitrate mode.
|
libxvid |
-q:v |
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 -b:v 200K unless specified otherwise. |
libtheora |
-q:v |
0 | 10 | n/a | 7 | No VBR by default—it uses -b:v 200K unless specified otherwise. |
mpeg1, mpeg2, mpeg4, flv, h263, h263+, msmpeg+ |
-q:v |
31 | 1 | ? | 3–5 | 2 is visually lossless. Doubling the value results in half the bitrate.-q:v works for mpeg4, but haven't tested others. |
prores_ks |
-profile:v-q:v |
Profile: 0 Quality: 32 |
Profile: 5 Quality: 0 |
Profile: 2 Quality: n/a |
Profile: Depends Quality: 9–13 |
Recommended software ProRes encoder. Profiles: 0=Proxy, 1=LT, 2=Standard, 3=HQ, 4=4444, 5=4444 XQ. Quality controlled via -q:v (0=best, 32=worst), recommended 11. Only encoder supporting 4444/XQ and alpha channels. See VFX Encoding Guide.Note: prores and prores_aw encoders also exist but lack profile and quality controls.
|
prores_videotoolbox |
-profile:v |
0 | 5 | auto | Depends | macOS hardware ProRes encoder. Profiles: 0=Proxy, 1=LT, 2=Standard, 3=HQ, 4=4444, 5=XQ. Profile auto-selected based on input format. |
| Encoder | Param | Qmin | Qmax | Qdef | Recommended | Notes |
|---|---|---|---|---|---|---|
libfdk_aac |
-vbr |
1 | 5 | ? | 4 (~128kbps) | Highest quality AAC encoder. Not available in standard builds—requires custom compilation with --enable-libfdk-aac --enable-nonfree. |
libopus |
-b:a |
6–8K (mono) | – | 96K (for stereo) | – | -vbr on is default, -b:a just sets the target, see FFmpeg documentation. |
libvorbis |
-q:a |
0 | 10 | 3 | 4 (~128kbps) | Make sure not to use vorbis, which is the (bad) internal encoder. |
libmp3lame |
-q:a |
9 | 0 | 4 | 2 (~190kbps) | Corresponds to lame -V. See FFmpeg Wiki. |
aac_at |
-q:a-aac_at_mode |
n/a | n/a | auto | VBR mode with -q:a |
macOS AudioToolbox AAC encoder. High quality, supports multiple VBR modes (vbr, cvbr, abr). Use -aac_at_mode vbr with -q:a for quality-based VBR. Generally better quality than native aac encoder. |
aac |
-q:a |
0.1 | 2 | ? | 1.3 (~128kbps) | Native FFmpeg AAC encoder (second-best quality). VBR mode via -q:a is "experimental and [likely gives] worse results than CBR" according to FFmpeg Wiki. Ranges from 18 to 190kbps. Prefer libfdk_aac or aac_at (macOS) for better quality. |