Configure libvpx-vp9 Undershoot for Constant Bitrate
This article explains how to properly configure the undershoot
percentage (-undershoot-pct) in the libvpx-vp9
encoder to achieve a stable Constant Bitrate (CBR). You will learn how
this parameter interacts with other rate control settings in FFmpeg and
the exact command-line configurations required for both strict and
optimized CBR streams.
Understanding Undershoot Percentage in VP9
The -undershoot-pct parameter in the
libvpx-vp9 encoder dictates how much the encoder is allowed
to drop below the target bitrate during low-complexity scenes (such as
static screens or simple animations). It accepts integer values from
0 to 100, representing the percentage of
target bitrate variance allowed on the lower bound.
To maintain a true Constant Bitrate, you must configure this parameter alongside target, minimum, and maximum bitrates, as well as the overshoot percentage.
How to Configure Undershoot for Strict CBR
If your streaming pipeline or hardware decoder requires a strictly flat bitrate stream (where the bandwidth utilization remains completely constant even during static scenes), you must minimize the allowed undershoot.
Recommended Settings for Strict CBR
-undershoot-pct: Set to0or a very low value (e.g.,5). This forces the encoder to spend the allocated bitrate by lowering quantization noise or inserting filler data during easy-to-encode scenes.-overshoot-pct: Set to0to prevent the encoder from exceeding the target limit.-minrateand-maxrate: Must be set identical to the target bitrate (-b:v).-bufsize: Controls the rate control buffer size. For CBR, this should typically be set to 50% to 100% of the target bitrate.
FFmpeg Command Example (Strict CBR)
ffmpeg -i input.mp4 -c:v libvpx-vp9 \
-b:v 2000k -minrate 2000k -maxrate 2000k -bufsize 1000k \
-undershoot-pct 0 -overshoot-pct 0 \
output.webmHow to Configure Undershoot for Optimized CBR (Recommended for Web/Streaming)
For most live streaming scenarios (such as WebRTC or DASH/HLS streaming), a “strict” physical constant bitrate is inefficient. It wastes bandwidth on static frames. Instead, you should target a capped CBR where the bitrate never exceeds the limit but is allowed to drop to save bandwidth when nothing is happening on screen.
Recommended Settings for Optimized CBR
-undershoot-pct: Set to100. This allows the encoder to drop the bitrate as much as necessary during completely static scenes, saving massive amounts of bandwidth.-overshoot-pct: Set to0(or up to15for low-latency live streams to allow brief spikes for sudden high-motion scenes).
FFmpeg Command Example (Optimized CBR)
ffmpeg -i input.mp4 -c:v libvpx-vp9 \
-b:v 2000k -minrate 2000k -maxrate 2000k -bufsize 1000k \
-undershoot-pct 100 -overshoot-pct 0 \
output.webmSummary of Parameter Roles
| Parameter | Recommended Value (Strict) | Recommended Value (Optimized) | Description |
|---|---|---|---|
-b:v |
e.g., 2000k |
e.g., 2000k |
Target video bitrate. |
-minrate |
Equal to -b:v |
Equal to -b:v |
Minimum allowed bitrate. |
-maxrate |
Equal to -b:v |
Equal to -b:v |
Maximum allowed bitrate. |
-undershoot-pct |
0 to 5 |
100 |
Allowed percentage drop below target bitrate. |
-overshoot-pct |
0 |
0 (or 10 for
live) |
Allowed percentage spike above target bitrate. |