Making GIFs From Videos in Linux
I started making some
.gifs to embed in documentation and my notes as I
develop Rusty Nail. I always have to lookup how to
convert the images to
gifs. Every time I am also concerned with how big the
.gifs are so after doing some looking around I made a little script which
giflossy) to take an input
webm, or any video that ffmpeg can decode.
The process is this:
ffmpegsplits the video into a directory of
convertthose images and stitches them together into one
gifand allow a stage to resize it and also change the color. The
giflossyplug-in also can apply lossy compression to the gif video during the optimization step.
Read on for the script.
To use my
make_gif.sh script you will need the following applications:
- ffmpeg (I used version 3.1.5)
- Imagemagick (ImageMagick 6.9.3-0 Q16 x86_64 2016-05-14)
- giflossy: Which you will need to install from source.
These should be installable from Ubuntu 16.04 or Fedora 25.
$ make_gif.sh -o my_new_image.gif input_file.mp4
You can get help information with:
$ make_gif.sh -h
gifs are a pretty useful format for adding video content to
documentation. I realize that the
.webm format might be a better alternative,
in the long run. With less effort, you can get higher compression rates and
smaller file sizes, all with better quality and the option for integrating