Libvpx Undershoot and Overshoot Settings Explained
This article explores the impact of the undershoot and overshoot
percentage settings in the libvpx encoder, which is widely
used for compressing VP8 and VP9 video formats. These parameters dictate
how strictly the encoder adheres to a target bitrate during variable
bitrate (VBR) and constant bitrate (CBR) encoding. Understanding how to
configure these settings allows you to strike the ideal balance between
consistent video quality, efficient file sizing, and stable network
streaming.
Understanding the Parameters
In libvpx, rate control is managed using two key
percentage parameters: --undershoot-pct and
--overshoot-pct. These settings tell the encoder how much
it is allowed to deviate from the target bitrate on a frame-by-frame or
scene-by-scene basis.
- Undershoot Percentage
(
--undershoot-pct): This parameter sets the maximum percentage by which the encoder can drop below the target bitrate. For example, if your target is 2000 kbps and the undershoot is set to 20%, the encoder is allowed to drop the bitrate down to 1600 kbps during simple, low-motion scenes to save bandwidth. - Overshoot Percentage
(
--overshoot-pct): This parameter sets the maximum percentage by which the encoder can exceed the target bitrate. If the target is 2000 kbps and the overshoot is set to 50%, the encoder can spike up to 3000 kbps during highly complex, high-motion scenes to prevent visual degradation like blocking or pixelation.
Impact on Video Quality and Compression Efficiency
The range you set for these parameters determines how “flexible” the encoder is, directly affecting both visual quality and storage efficiency.
High Flexibility (Loose Settings)
When you allow high undershoot and overshoot percentages (e.g., 100% undershoot and 50% overshoot), the encoder behaves like a true Variable Bitrate (VBR) system. * Pros: Outstanding overall visual quality and highly efficient file sizes. The encoder saves bits during static talking-head scenes and spends those saved bits generously on fast-action sequences. * Cons: Highly unpredictable file sizes and bitrates, making the output stream unsuitable for strict bandwidth-limited environments.
Low Flexibility (Strict Settings)
When you restrict these percentages to low values (e.g., 0% to 10%), you force the encoder into a Constant Bitrate (CBR) or “constrained VBR” mode. * Pros: Highly predictable file sizes and stable data transmission rates. * Cons: Decreased visual quality. Complex scenes will suffer from compression artifacts because the encoder is not allowed to use extra bits, while simple scenes will waste bandwidth by using more bits than necessary to meet the minimum bitrate threshold.
Best Practices for Common Use Cases
To get the best results from libvpx, tailor these
settings to your specific delivery platform:
- Live Streaming: Set both undershoot and overshoot to low values (e.g., 10% to 15%). This prevents sudden bitrate spikes that could cause buffering for viewers with weak internet connections, while still allowing a tiny cushion for encoder adjustments.
- Video on Demand (VOD) and Archiving: Use a more relaxed configuration. Setting the undershoot to 100% and the overshoot to 50% (or using the encoder’s default VBR mode) allows the encoder to optimize for the best possible visual quality per gigabyte of file size.