From Linuxintro

recordmydesktop is a program that allows you to take a video from your Linux desktop. In practice, you often want to record a window only. To do this, start recordmydesktop like this:

recordmydesktop --windowid $(xwininfo | grep "Window id" | awk '{print $4;}')

A cross will appear. Aim it at the window you want to record and click. Then the recording will start.

Reduce file size

To reduce the video file's size start vlc and convert the video using the menu Media -> Convert/Save.

Correct errors

Once I wanted to do a recording of a webcam displaying my video on my desktop on a slow computer. cheese that I used with the webcam warned that it would drop a lot of buffers. My solution was not to use recordmydesktop, but ffmpeg like this:

ffmpeg -f x11grab -s hd720 -r 15 -i :0.0 screenCapture.avi