

In the example below, we generate output.mp4 which is twenty times the length of input.mp4.įfmpeg -stream_loop 20 -i input.mp4 -c copy output.mp4 The -stream_loop N option lets you loop (concatenate) the input video N times.

See also this article from GIPHY Engineering. This gist walks you through creating a GIF with ffmpeg and gifsicle.

A more complicated solution is explained in this answer on the Super User StackExchange, along with an article detailing how to obtain better-looking GIFs from ffmpeg. This method tends to output poorer-quality GIFs. For some reason I couldn’t apply the setpts filter in a direct MOV to GIF pipeline, so I’m first making a sped-up MP4, then converting that to a GIF. The command above makes an MP4 video at twice the speed of the original MOV. Ffmpeg -i my-recording.mov -filter:v "setpts=0.5*PTS" my-recording-sped-up.mp4
