Skip to content

Instantly share code, notes, and snippets.

@nosajio
Created October 14, 2017 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nosajio/7fb7668ef5b1c5a46332ea841079ba8b to your computer and use it in GitHub Desktop.
Save nosajio/7fb7668ef5b1c5a46332ea841079ba8b to your computer and use it in GitHub Desktop.
How to make a gif animation from a video file with FFMPEG

First, save the input video as individual frames at 10 FPS:
ffmpeg -i input.mp4 -vf scale=500:-1:flags=lanczos,fps=10 frames/ffout%03d.png

Next, join the frames up again to make the gif:
ffmpeg -i ./frames/ffout%03d.png output.gif

Bonus to optimise the gif with gifsicle:
gifsicle -O3 output.gif -o output-optimized.gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment