Loop a video with FFmpeg

Repeats a clip a fixed number of times using the stream loop input option.

ffmpeg -stream_loop 2 -i https://cdn.rendobar.com/assets/examples/sample.mp4 -c copy -t 12 out.mp4
Encode
55 ms
Output
811.7 KB
Cost
$0.0015
Result
1280x720

job_cd3d202916d14bf0

The part everyone gets wrong

-stream_loop is an INPUT option, so it must appear before -i. Placed after, it is ignored silently and you get one copy. The count is repeats rather than total plays, so -stream_loop 2 yields three passes, and -1 loops forever.

Frequently asked questions

How do I loop video ffmpeg?

Repeats a clip a fixed number of times using the stream loop input option.

What goes wrong most often?

-stream_loop is an INPUT option, so it must appear before -i. Placed after, it is ignored silently and you get one copy. The count is repeats rather than total plays, so -stream_loop 2 yields three passes, and -1 loops forever.

Do I need FFmpeg installed?

Not with Rendobar. The command on this page ran through the API against a URL, with no local FFmpeg and no server. The job id below it is the job that produced these numbers.

Run this without installing FFmpeg

This exact command ran through the API against a URL.