13
- March
2017
Posted By : Sunny Srinidhi
Create an animated GIF of your screencast on Linux

Animated GIFs of screencasts are everywhere today. How do you go from taking a screenshot of your desktop with the “Print Screen” button and recording a video of your desktop to creating an animated GIFs of your screencast to share on the internet? It’s actually easier than you think. I’m going to tell you how to do it on a Linux machine, specifically Ubuntu, because I use an Ubuntu machine. The commands here are for Ubuntu, but they can very easily be ported to other *nix machines as well.


First, you’ll need to install a few tools: ImageMagick, MPlayer, and RecordMyDesktop. We’ll be using RecordMyDesktop to record the activities on your screen or a portion of your screen as a video file. We’ll use MPlayer to convert that video into a bunch of JPEG images. We’ll then use ImageMagick’s magic to stitch them all together into an animated GIF. Sounds pretty easy, right? Let’s get started.


We’ll start by installing the required tools. For this, open up a terminal and enter the following command:

sudo apt-get install imagemagick mplayer gtk-recordmydesktop

After this, you’ll need to open RecordMyDesktop app and record your screen. You can select a portion of your screen, or a particular application, or the whole desktop, depending on your needs. Once you record and save the file, run the following command to convert the video file into a bunch of JPEG images files in the directory specified in the “outdir” option:

mplayer -ao null <video file name> -vo jpeg:outdir=output

Then, run the following ImageMagick command to convert all the JPEG files into an animated GIF.

convert output/* output.gif

That’s it, your animated screencast is ready. If you want, you can optimise the GIF file using the command:

convert output.gif -fuzz 10% -layers Optimize optimised.gif

That’s all. You can now share your animated GIF with the world. As an example, the GIF attached to my tweet here was created with these commands.

Leave a Reply