Configure VP9 Undershoot and Overshoot in FFmpeg

This article explains how to configure the undershoot-pct and overshoot-pct parameters in the FFmpeg libvpx-vp9 encoder. You will learn what these bitrate control settings do, how they affect video quality and file size during encoding, and the exact FFmpeg commands required to implement them.

Understanding VP9 Undershoot and Overshoot

When encoding video with the VP9 codec (libvpx-vp9) in Variable Bitrate (VBR) or Constrained Quality (CQ) modes, the encoder dynamically adjusts the bitrate based on the complexity of the video scenes. The undershoot-pct and overshoot-pct parameters define the limits of this variation.

Configuring these parameters helps you maintain a balance between consistent visual quality and strict file size/bandwidth limitations.

How to Configure the Parameters in FFmpeg

In FFmpeg, these parameters are passed as private options to the libvpx-vp9 encoder. The syntax uses the flags -undershoot-pct and -overshoot-pct followed by an integer value.

For typical streaming workflows where you want to prevent massive buffer spikes but still save bits on simple scenes, the following configurations are recommended:

Example FFmpeg Command

The following command demonstrates how to apply these settings during a two-pass VP9 encoding process:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 2M -undershoot-pct 50 -overshoot-pct 15 -an output.webm

In this command: * -c:v libvpx-vp9 selects the VP9 encoder. * -b:v 2M sets the target video bitrate to 2 Mbps. * -undershoot-pct 50 allows the bitrate to drop down to 1 Mbps (50% of target) for easy-to-encode frames. * -overshoot-pct 15 limits the maximum bitrate to 2.3 Mbps (115% of target) for complex frames.