GIFs are popular now than before. They are useful because many media players like Real Video Player, Windows Media and other formats required a special codec and/or browser plugin. Though better video stands now exists in modern day browsers, GIFs still remain popular.
There are many utilities that are able to convert videos to GIFs. I use
ffmpeg
.
Installation
On Ubuntu:
sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get install ffmpeg
sudo apt-get install frei0r-plugins
On OS X, I use brew
, similar to MacPorts, a Linux like package (formulas in the Homebrew’s language)manager with a
lot of useful tools and simplifies installations.
brew doctor # check installation was successful and installation of formulas (packages) will work
brew options ffmpeg # shows all available options for the formula being installed
brew install ffmpeg # add other desired options
For installation on the system running RHEL 7, I followed this Stack Overflow answer:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum-config-manager --add-repo https://negativo17.org/repos/epel-multimedia.repo
yum install ffmpeg
Convert Video to GIF
It’s quite easy to make the conversion with ffmpeg
:
ffmpeg -i <video-filename> <gif-filename>
For a more control conversion:
ffmpeg -t 3 -ss 00:00:02 -i <video-filename> <gif-filename>
This directs ffmpeg
to create a 3 seconds long GIF starting at 2 seconds into the video.
With ffmpeg
, if you’re not happy with the default quality, you can configure the bitrate:
ffmpeg -i <video-filename> -b 2048k <gif-filename>
Of course ffmpeg
allows bidirectional conversion: you can convert videos to GIFs, and GIFs to videos.