Skip to content

Convert video AVI/MPEG/MP4 to a Gif animation on Linux

How to convert a video file to an animated GIF on Linux:

  1. Install required software:
    apt-get install ffmpeg gifsicle imagemagick:
  2. Convert the video file to a series of small images:
    mkdir /tmp/gif/
    ffmpeg -i YOURVIDEOFILE.mp4 -r 10 -s 711×400 /tmp/gif/out%04d.gif 
  3. Combine these images together into a GIF animation:
    gifsicle –delay=10 –loop /tmp/gif/*.gif > animation.gif
  4. Optimise the GIF animation so the file size is smaller:
    convert -layers Optimize animation.gif animation_optimized.gif 
Published inLinux

One Comment

  1. Exactly what I need .. Thanx for writing it up!

Leave a Reply

Your email address will not be published. Required fields are marked *

© dtbaker.net