How Keyframe Frequency Affects Animated AVIF Files

Keyframe frequency directly determines the balance between file size, compression efficiency, and playback performance when creating animated AVIF images. Animated AVIF relies on the AV1 video codec, using intra-frames (keyframes) and inter-frames (delta frames) to render motion. Adjusting how often these keyframes appear dictates whether an animation compresses aggressively like a static-heavy video or prioritizes fast random access and low decoding latency.

Understanding Keyframes in Animated AVIF

An animated AVIF file is structurally an AV1 video stream wrapped in an image container. Within this stream, a keyframe (or I-frame) is a complete, standalone image that contains all the visual data required for rendering. Intermediate frames (P-frames or B-frames) only store the differences between consecutive frames. The keyframe frequency, often controlled via the Group of Pictures (GOP) size or --keyint setting in encoders like rav1e, SVT-AV1, or libaom, sets the maximum number of delta frames allowed before the encoder must insert a full image refresh.

Impact on File Size and Compression

Keyframe frequency is one of the most critical levers for reducing animated AVIF file sizes:

Impact on Decoding and CPU Usage

While infrequent keyframes shrink the file, they shift the computational burden to the decoder (such as a web browser):

The optimal keyframe frequency depends entirely on the duration and purpose of the animation: