Creating a screencast in Linux

Recently I wanted to create a simple screencast in Linux (Debian GNU/Linux). I remember I used “gtk-recordmydesktop” and “instanbul” before, but I don’t have that average audio setup anymore. Today it consists of an internal Intel audio chipset and an external U46DJ USB audio device.

gtk-recordmydesktop completely sucks when it comes to selecting your audio device. Normally accesible by the ALSA descriptor “hw:1″, recordmydesktop wasn’t able to use it. Istanbul completely failed to render the audio part.

So after some googleing I found out about the perfect solution: ffmpeg and jack_capture. I wrote a little script that combines the steps involved. Here it is:

At first it runs ffmpeg in the background. Be sure to adjust the parameters if you’re adopting it. Then jack_capture is launched – again, take care of parameters for your system (especially the Jack port). Of course you need to startup Jackd before you run the script (can be easily done through qjackctl normally).

jack_capture is also capable of saving directly to MP3s, however it must be compiled with the proper support, and on Debian it isn’t (due to MP3 licensing problems). Converting however isn’t a problem at all, just invoke: (of course now you really need liblame or similar; for Debian see the Debian Multimedia Library)

Normally this produces a high-quality MP3 – if not, adjust settings (see “man ffmpeg” for help).

The last step is muxing both streams, so that you’re left with only one file. Again we use ffmpeg for that (make sure you have the MP3 ready!):

The video and audio streams are simply copied to the target file. What comes out is a high-quality video/audio file, congratulations. :-)

One note on possible syncing problems: Since ffmpeg (the capturing part) and jack_capture are launched after each other, there may be a delay of some milliseconds. In my tests I wasn’t able to recognize it. But this may depend on your system.

Stefan is a C++ programmer with a passion. He’s often driven by pragmatic principles and especially loves game development, Debian GNU/Linux and Vim.

Twitter 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">