My favorite screencast solution for now is summarized here.
I use the following command to do fullscreen (assume resolution is 1024×768) screencast
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s 1024x768 -i :0.0 -acodec flac -vcodec mpeg4 -sameq -y ~/out.mkv ;
To restrict capture to a window, one can run to select the windows to capture (click the target window twice)
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s $(xwininfo -frame | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+') -i :0.0+$(xwininfo -frame | grep -oEe 'Corners: +\+[0-9]+\+[0-9]+' \ | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' ) -acodec flac -vcodec mpeg4 -sameq -y ~/out.mkv ;
I then usually run a batch file to convert mkv convert it to avi. To convert out.mkv, one can run
mencoder out.mkv -ovc xvid -oac mp3lame -xvidencopts pass=1 -o out.avi
The conversion also allows me to chop the beginning and the end of the file. For example, the following will only include video from the first to the tenth second.
mencoder out.mkv -ovc xvid -oac mp3lame -xvidencopts pass=1 -ss 1 -endpos 10 -o out.avi
For the length of the mkv file, one can find it with mkvinfo as follows
mkvinfo a1.mkv|grep -oEe 'Duration: [0-9]+.[0-9]+'|grep -oEe '[0-9]+.[0-9]+'
Finally, if you have many screencast files (for example, out1.avi, out2.avi, out3.avi), one can paste them into one with
mencoder -oac copy -ovc copy -o out.avi out1.avi out2.avi out3.avi