Celeb Glow
news | February 26, 2026

How to control gif loop settings in FFmpeg

I'm able to export a sequence of images as a gif with FFmpeg:

ffmpeg -vsync 2 -safe 0 -f concat -i "file:concat.txt"
-lavfi palettegen=stats_mode=diff[pal],[0:v][pal]paletteuse=new=1:diff_mode=rectangle
-y "Test.gif"

Now, I'm wondering if I can control somehow the loop settings (repeat forever, repeat n times, etc).

I could not find any "loop" on FFmpeg.org documentation.

1 Answer

Use the -loop option for the GIF muxer

ffmpeg -i input -loop 2 output.gif
  • -1 no loop (plays once)
  • 0 infinite loop (default)
  • 1 loop once (plays 2 times)
  • 2 loop twice (plays 3 times)
  • etc

See ffmpeg -h muxer=gif.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy