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.

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.webm

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.

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.webm

Summary 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.