Screen capture of a selected window with ffmpeg in Ubuntu

After some trial and error and reading some other posts, I finally manage to capture screencast of a selected window with ffmpeg under 10.04. I am using the native ffmpeg from ubuntu and so recompiling is not needed. The command I’m using is as below.

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 pcm_s16le -vcodec mpeg4 -sameq -y out.mkv ;

The command will capture a particular window. After running the command, one has to click the window one wants to capture twice (getting size and then getting location).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s