Default GOP Size for libsvtav1 Encoder

This article provides a direct answer regarding the default Group of Pictures (GOP) size used by the libsvtav1 video encoder. You will learn the default keyframe interval settings, how the encoder calculates this value automatically, and how to manually override it in your encoding workflow.

The Default GOP Size

By default, the libsvtav1 (SVT-AV1) encoder utilizes an automatic GOP size (keyframe interval). In the encoder’s configuration, this is represented by a default value of -1 (auto).

When set to auto, libsvtav1 targets a keyframe interval of approximately 5 seconds.

The exact number of frames in the GOP depends on the frame rate of the input video: * For 24 fps, 25 fps, and 30 fps video: The default auto-calculation typically resolves to a GOP size of 161 frames. * For 60 fps video: The auto-calculation scales to a GOP size of approximately 300 frames.

Mini-GOP Size vs. Keyframe Interval

It is important to distinguish between the overall GOP size (keyframe interval) and the mini-GOP size: * Keyframe Interval (GOP Size): The distance between IDR/Keyframes (defaults to ~5 seconds/161 frames). * Mini-GOP Size: The hierarchical prediction structure size. In SVT-AV1, the default mini-GOP size is 16 (indicated by the --hierarchical-levels 4 parameter, which results in a mini-GOP of \(2^4 = 16\) frames).

How to Manually Adjust the GOP Size

If you want to define a fixed GOP size instead of relying on the default 5-second auto-calculation, you can define it manually depending on the tool you are using.

Using FFmpeg

In FFmpeg, you can set the GOP size using the -g flag. For example, to set a strict 2-second GOP for a 30 fps video (60 frames):

ffmpeg -i input.mp4 -c:v libsvtav1 -g 60 output.mkv

Using SVT-AV1 Parameters

If you are passing parameters directly to the SVT-AV1 library, use the keyint or intra-period parameter:

ffmpeg -i input.mp4 -c:v libsvtav1 -svtav1-params keyint=60 output.mkv