Force Strict Keyframe Interval in libsvtav1

Forcing a strict keyframe (GOP) interval in the SVT-AV1 encoder is crucial for streaming protocols like HLS or DASH, where segment alignment is required. This article provides a straightforward guide on how to configure FFmpeg and libsvtav1 parameters to disable scene change detection and enforce a fixed, predictable keyframe interval.

To force a strict keyframe interval when using libsvtav1 in FFmpeg, you must set the minimum and maximum keyframe intervals to your desired frame count and explicitly disable scene change detection. By default, SVT-AV1 will insert extra keyframes at scene cuts, which breaks strict intervals.

The FFmpeg Command

Use the following FFmpeg command template to enforce a strict keyframe interval:

ffmpeg -i input.mp4 -c:v libsvtav1 -g 120 -keyint_min 120 -svtav1-params scd=0 output.mp4

Parameter Breakdown

(Note: Depending on your FFmpeg and SVT-AV1 version, you can also use sc-detection=0 instead of scd=0 in the parameter string.)

Standalone SVT-AV1 Encoder (SvtAv1EncApp)

If you are using the standalone SvtAv1EncApp executable instead of FFmpeg, use the following arguments to achieve the same result:

SvtAv1EncApp -i input.y4m -b output.ivf --keyint 120 --scd 0

By combining equal minimum/maximum interval values with the deactivation of scene change detection, libsvtav1 will output keyframes at the exact frame interval specified.