Why Use Alternate Reference Frames in VP9

Enabling automatic alternate reference frames (alt-ref frames) in the libvpx-vp9 encoder is a fundamental step in producing professional-grade, highly compressed web video. This article explores how alt-ref frames function as hidden, ultra-high-quality reference points that drastically reduce temporal noise and improve compression efficiency. By understanding how these frames operate, developers and video engineers can unlock the full visual potential of the VP9 codec without inflating file sizes.

What Are Alternate Reference Frames?

Unlike traditional video codecs like H.264, which rely heavily on displayed B-frames (bi-directional predictive frames) for compression, VP9 uses a unique structure called Alternate Reference Frames (ARFs). An alt-ref frame is a non-display frame. It is decoded and stored in the buffer but never actually shown to the viewer. Instead, it serves as a highly optimized reference point that future displayed frames can use to predict their content.

How Alt-Ref Frames Enhance Visual Quality

The primary reason automatic alt-ref frames are crucial for high visual quality comes down to how they are constructed and utilized during encoding:

1. Advanced Temporal Filtering and Noise Reduction

When automatic alt-ref frames are enabled, the libvpx encoder performs temporal filtering across multiple adjacent frames. It analyzes look-ahead frames to identify background areas and static elements, blending them together to average out sensor noise and compression artifacts. This creates a clean, denoised reference frame that represents the true background of the scene.

2. Drastic Bitrate Savings

Because the alt-ref frame is exceptionally clean and noise-free, subsequent displayed frames can reference it to encode only the actual motion or changes in the scene. The encoder does not have to waste precious bits re-encoding background noise or static details frame after frame. These saved bits are then redistributed to high-motion sequences or complex details, resulting in a much higher overall visual quality at the same bitrate.

3. Smooth Transitions and Reduced Pulsing

Without alt-ref frames, video encoders often suffer from “keyframe pulsing,” where quality visibly degrades right before a new keyframe and jumps back up immediately after. Alt-ref frames act as mid-point quality boosters. By providing a high-quality hidden reference in the middle of a Group of Pictures (GOP), they smooth out quality fluctuations and eliminate distracting visual jumps.

Implementation in libvpx-vp9

To achieve the best results, automatic alt-ref frames should be used in conjunction with two-pass encoding. In FFmpeg, this is enabled by default when using standard VP9 configurations, but it can be explicitly controlled using the following parameters:

By utilizing these settings, the libvpx-vp9 encoder transitions from a basic video compression tool into a highly intelligent optimizer, delivering crisp, broadcast-quality video at a fraction of the bitrate.