Recording screens with ffmpeg

On the Mac, we can record our screens with QuickTime. On other *nix, ffmpeg can be deployed in this fairly straight-forward manner:

% ffmpeg -f x11grab -s 1024x768 -r 30 :0.0 ~/out.mp4

Except in Debian now, we get this:

The ffmpeg program is only provided for script compatibility and will be removed in a future release. It has been deprecated in the Libav project to allow for incompatible command line syntax improvements in its replacement called avconv (see Changelog for details). Please use avconv instead. Requested output format ‘x11grab’ is not a suitable output format

Amongst the politics, I was surprised that ‘x11grab’ was not a suitable output format. I’d been doing it for years. In the schism between ffmpeg and the unfortunately named avconv, had this changed?

Well, first step was to install avconv:

# apt-get install avconv
==> Building dependency tree
==> Reading state information... Done
==> E: Unable to locate package avconv

# apt-get install libav
==> Building dependency tree
==> Reading state information... Done
==> E: Unable to locate package libav

Not having much luck here! Time to do a search.

# apt-cache search libav
==> ffmpeg - Multimedia player, server, encoder and transcoder (transitional package)
==> libav-tools - Multimedia player, server, encoder and transcoder

Yay for Linux naming consistency! Installing that and trying video recording:

# apt-get install libav-tools
$ avconv -f x11grab -s 1024x768 -r 30 :0.0 ~/out.mp4

And now it works! Now then… how do we stop it recording? Last time I did this with ffmpeg, we’d use q. From Ubuntu, this doesn’t work:

Newer versions of ffmpeg don’t use ‘q’ anymore, at least on Ubuntu Oneiric, instead they say to press Ctrl+C to stop them. So with a newer version you can simply use ‘killall -INT’ to send them SIGINT instead of SIGTERM, and they should exit cleanly.

Now we can record and stop recording video. Phew.