From: http://askubuntu.com/a/107735/85224
First install this:
sudo apt-get install imagemagick mplayer gtk-recordmydesktop
those are the required stuff, ImageMagick, MPlayer and Desktop Recorder. Then use Desktop Recorder to capture a portion of the screen/application to use as the screencast. After the Desktop Recorder has saved the recording into an OGV video, MPlayer will be used to capture JPEG screenshots, saving them into the 'output' directory.
On a terminal: