Skip to content

Instantly share code, notes, and snippets.

@tfogo
Created April 8, 2014 13:19
Show Gist options
  • Save tfogo/10122911 to your computer and use it in GitHub Desktop.
Save tfogo/10122911 to your computer and use it in GitHub Desktop.
How to convert videos to gif using ffmpeg and gifsicle
How to convert a video file to an animated GIF on Linux:
Install required software:
apt-get install ffmpeg gifsicle imagemagick:
Convert the video file to a series of small images:
mkdir /tmp/gif/
ffmpeg -i YOURVIDEOFILE.mp4 -r 10 /tmp/gif/out%04d.gif
Combine these images together into a GIF animation:
gifsicle –delay=10 –loop /tmp/gif/*.gif > animation.gif
Optimise the GIF animation so the file size is smaller:
convert -layers Optimize animation.gif animation_optimized.gif
@nquinlan
Copy link

nquinlan commented Oct 26, 2021

gifsicle changed its flags from -flag to *NIX convention --flag, thus making line 9:

gifsicle -–delay=10 -–loop /tmp/gif/*.gif > animation.gif

@nquinlan
Copy link

P.S. Hey Tim! Thanks! Would you believe this was the first result on Google for gifsicle movie to gif?

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