Something that I do for a lot of my posts is create animated gifs, and usually I forget the whole process and have to re-look up everything. So here I will consolidate the process. There are four steps: 1) record video; 2) convert to images; 3) trim down image set; 4) convert to gif.
First, I’ve had luck recording the original video using the SimpleScreenRecorder program. Installation instructions are on their homepage, it’s very simple. I had been using RecordMyDesktop and tried Kazam, but prefer SimpleScreenRecorder.
Once you have your video, create a folder to store all your images in.
I called mine ‘images’.
To convert the video to a set of images we’ll need
mplayer. In linux to install this it’s just
sudo apt-get install mplayer2
Once you have
mplayer installed, change directories into your images folder and run
mplayer -ao _ ../movie_name.mp4 -vo png:z=9
This will fill up the folder with a bunch of screenshots from the video.
At this point you can go ahead and convert these images into an animated gif, but I always trim down the set to reduce the gif size. This just entails me going through and deleting every other image until I get a file that’s less than a megabyte. Once you’ve got the image set that you want to convert, you’re going to need ImageMagick installed. If you don’t have it, just run
sudo apt-get install imagemagick
Once you have that you’re going to use the
convert -delay 10 -loop 0 -deconstruct -quantize transparent -layers optimize -resize 400x400 *.png animation.gif
with a bunch of extra options attached to control the play speed (that’s the
delay parameter), the looping, some optimization parameters, and then what size it comes out (I’ve chosen 400×400 pixels here).
And there you go! You can now create your own fancy gifs.