How to Create a Screencast in Ubuntu
This is something I have wanted to do for a long time now. Screencasting can be very useful for explaining new concepts, demonstrating beta products, and heck, maybe even for filing better bug reports!
The screencasting method I present here is not something I came up with. I saw it first at Quim Gil’s blog. A commenter mentioned how there was an article at clemens.endorphin.org explaining the process, and even posted instructions on how to be able to do this. So, as usual, my job is to publicize what is already known to a few.
.You will need to patch, compile, and use ffmpeg to generate the screencasts. Let me try and make it very easy to do:
Open a terminal, and create a new directory called “software” in your home directory. This is optional, you don’t have to do it, but I do this to keep things organized on my computer:$mkdir software
$cd software
So now you are in the newly created “software” directory.
Get the source for ffmpeg:$wget http://un.sh.nu/screencasts/ffmpeg-0.4.9-p20051216.tar.bz2
Extract it:$tar xjfv ffmpeg-0.4.9-p20051216.tar.bz2
Change to the newly extracted directory:$cd ffmpeg-0.4.9-p20051216
Download the patch:$wget http://un.sh.nu/screencasts/ffmpeg-0.4.9-p20051216.diff
Apply the patch:$patch -Np1 -i ffmpeg-0.4.9-p20051216.diff
Now before we start compiling the source, you will need a couple of packages installed on your computer. The “build-essential” package will give you the compiler and other tools needed to compile packages, and the “xlibs-dev” package will be required to compile ffmpeg successfully. Let’s install both of these:$sudo apt-get install build-essential xlibs-dev
Let’s get started now, configure the beast:$./configure --extra-ldflags=-L/usr/X11R6/lib --enable-x11grab --enable-gpl
…and then “make” it:$make
That’s it! Now you have an executable called “ffmpeg” in the directory you are in (~/software/ffmpeg-0.4.9-p20051216/)
You can use this to create your screencasts.
I find the following command good for my purposes:$./ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -vd x11:0,0 -s 1024x768 ~/test.avi
..where:
-vd x11:0,0 says that the offset to use for recording is x=0 and y=0
and
-s 1024×768 says that the size of the video to be captured is 1024×768.
The video file “test.avi” will be created in your home folder.
You can change these and the other options (refer to the documentation for ffmpeg).
If you want to create a screencast of only one application window, or a specific portion of your desktop, you can do that by specifying the offsets (always calculated from the top-left of the desktop) and the size of the area to be captured.
I find the “xwininfo” command to be pretty useful to find these parameters.$xwininfo -frame
will give you the geometry of a window, including the window decorations (the title-bar, scrollbar etc).
You can resize the screencasts by using, (…surprise!…) ffmpeg. For example the following command will create a 800×600 video from the 1024×768 video:
./ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -i ~/test.avi -s 800×600 ~/test-800-600.avi
I created a small screencast to show how all this works out. However, the video quality at youtube and google videos leaves much to be desired. The original is much, much better — you can actually read the text in the screencast.
YouTube-hosted Screencast - A demo of the method where I learn to use xwininfo:
.
Post a Comment