« Back to Video

Make a screencast with Linux

Compile a patched version of FFmpeg

Make a new directory and get in it:

mkdir screencasts && cd screencasts

Get FFmpeg's source code,

wget http://www.misterhowto.com/files/linux_screencast/ffmpeg-0.4.9-p20051216.tar.bz2

and extract it here:

tar xvjf ffmpeg-0.4.9-p20051216.tar.bz2

Get into the new directory:

cd ffmpeg-0.4.9-p20051216

Now download the patch,

wget http://www.misterhowto.com/files/linux_screencast/ffmpeg-0.4.9-p20051216.diff

and apply it:

patch -Np1 < ffmpeg-0.4.9-p20051216.diff

Okay, now we need to compile FFmpeg. For this, you'll need a build environment (gcc compiler, etc.), and the XLibs development libraries. With Ubuntu, just do this:

sudo apt-get install build-essential xlibs-dev

(with another distribution, search for packages with similar names).

You need to change the first line of the "configure" file so that it reads "bash" instead of "sh":

nano configure

Now run the configure script with the right parameters:

./configure --extra-ldflags=-L/usr/X11R6/lib --enable-x11grab --enable-gpl

and start building


You should now have an executable file in your working directory, called ffmpeg. You can keep it here, or move it somewhere more convenient.

Make the screencast

./ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -vd x11:0,0 -s 1280x1024 test.avi

The "1000" parameter is the bitrate: increase it to get better quality, but larger files. "0,0" tells FFmpeg to record from the top-left cornet of the screen. You can also change "1280x1024" to match your screen resolution, or that of the window you want to record. In that case, you can use

xwininfo -frame

to get more information about a particular window's coordinates.


If you want to make several recordings and then merge them smartly together, you can take a loot at the Convert an AVI video to DV howto, and then use a video editing software like Kino to add transitions, subtitles, etc.

If you need something plainer and just want to join these screencasts without further editing, see the Join several videos with Mencoder howto.

You can also add a soundtrack to your video with help from the Change the audio track of a video with Mencoder howto.