How to Use FFmpeg Loop Filter to Repeat Frames

This article explains how to use the FFmpeg loop filter to repeat a specific range of frames within a video. You will learn the exact syntax of the filter, the meaning of its key parameters—such as loop count, frame size, and start index—and see a practical command-line example to implement this in your video processing workflow.

To repeat a specific frame range in FFmpeg, you apply the loop video filter (-vf). This filter requires you to define how many times the sequence should repeat, how many frames are in the sequence, and the starting frame number of the loop.

The Loop Filter Parameters

The basic syntax for the loop filter is: loop=loop=<count>:size=<number_of_frames>:start=<start_frame>

Practical Command Example

Suppose you have a video playing at 30 frames per second (fps). You want to repeat a 2-second segment (which equals 60 frames) that starts at the 5-second mark (frame index 150). You want this 60-frame segment to repeat 4 times.

You can achieve this with the following command:

ffmpeg -i input.mp4 -vf "loop=loop=4:size=60:start=150" -c:a copy output.mp4

Key Considerations