How to create an animated (GIF) screenshot
Added bonus with this approach is that you can post the screencast without embed tags on any forum that includes animated GIFs as embedded like this
The answers prior to mine have clearly answered how to create a video screencast. Now if you just want to show an animated screenshot, essentially an extremely short screencast in an image format (GIF, and not more than ~10 sec), it's also easy.
First create a screencast of what you want to show in the animated GIF. Then follow the instructions below...
You'll need Gimp, mplayer (WARNING! NOT mplayer2) and mencoder. Issue the following commands to install them.
sudo apt-get install gimp
sudo apt-get install mplayer
sudo apt-get install mencoder
sudo apt-get -f install
Alternatively, you can install them from the Synaptic package manager that comes with Ubuntu.
The following command breaks your screencast into a number of jpeg or png (based on which command you choose) images:
mplayer -ao null -ss 0:0:33 -endpos 2 eagles.avi -vo jpeg:outdir=Desktop/animated
mplayer -ao null -ss 0:0:33 -endpos 2 eagles.avi -vo png:z=9:outdir=Desktop/animated
Where, -ss 0:0:33
tells mplayer where you begin (0 hours, 0 minutes, 33 seconds), -endpos 2
tells mplayer where to stop (2 minutes), z=9
sets compression level for the output png images to 9, Desktop/animated
is the directory (~/Desktop/animated/) where you want the images to be output to.
You can also tell mplayer where to stop, as a specific time, like so:
mplayer -ao null -ss 0:0:33 -endpos 0:1:12 eagles.avi -vo jpeg:outdir=Desktop/animated
mplayer -ao null -ss 0:0:33 -endpos 0:1:12 eagles.avi -vo png:z=9:outdir=Desktop/animated
Now you have the images, but you need to combine them into a single, animated GIF. This is really simple:
Start Gimp > File > Open as Layers > browse to the directory (~/Desktop/animated/), Ctrl+A to select all images, and click 'Open'.
Simple hit Shift+Ctrl+S or go to File > Save As... and name the image as 'animated.gif' > hit 'Save' > check 'Save as Animation' radio button > hit 'Export' > in the next window, simply hit 'Save' unless you know what you are doing.
That's it. You have your animated GIF ready!
Here's an example:

PS: I am not very comfortable with the terminology when it comes to this kind of stuff, but I hope I am clear nevertheless. :)
SOURCE: http://www.youtube.com/watch?v=OhJtyblE_D0