>FFmpegLab Start free
FFmpeg Guide

How to loop video with FFmpeg

Repeat a clip a set number of times with -stream_loop, turn a still image into a video, loop to a target duration, or build a seamless boomerang.

The cleanest way to repeat a clip is -stream_loop, an input option that plays the source N extra times before encoding. Because it's an input flag, it goes before -i. Use -1 for an infinite loop, paired with a duration cap so the output isn't endless.

Key takeaways

Repeat a clip N times

Play the clip three more times (four total). Copying the stream keeps it lossless when the loop count is exact:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# 3 extra loops = clip plays 4 times total
ffmpeg -stream_loop 3 -i in.mp4 -c copy out.mp4

Loop to a target duration

Loop infinitely but stop at an exact length — handy for filling a 30-second background:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# loop forever, cut off at 30 seconds
ffmpeg -stream_loop -1 -i in.mp4 -t 30 -c copy out.mp4

Loop a still image into video

Turn a single image into a clip of any length — great for title cards or audio-with-cover-art:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# 10-second video from one image
ffmpeg -loop 1 -i cover.png -t 10 -c:v libx264 -pix_fmt yuv420p out.mp4

Seamless boomerang

Append a reversed copy so the clip plays forward then backward with no visible seam:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i in.mp4 -filter_complex \
  "[0:v]reverse[r];[0:v][r]concat=n=2:v=1[v]" -map "[v]" -an boomerang.mp4

Loop visually instead

FFmpegLab lets you set a loop count or target duration on the timeline and writes the matching -stream_loop command for you — fully offline. Trim to a clean loop point first, then export a looping GIF.

✦  Fresh from the render queue

Better FFmpeg workflows, delivered.

Get practical commands, new templates, and deep-dive guides for the edits that are usually hardest to get right.

✓  Copy-pasteable commands    ✓  Editor templates    ✓  No noise
One useful email at a time.

Loop and boomerang clips — in your browser.

Free in your browser — nothing to install, nothing uploaded.