Record Your Desktop With recordMyDesktop, Part 2

By: Carla Schroder
Wednesday, June 11, 2008 06:22:04 PM EST
URL: http://www.linuxplanet.com/linuxplanet/tutorials/6491/1/

Recording From a Microphone

Last week we learned how to make simple video screencasts on Linux with recordMyDesktop. Today we're going to record audio from a microphone, get acquainted with JACK, and convert MyDesktop's Ogg files into AVI formats.

Even the most low-budget onboard sound chip should have a microphone input. Plug in your mic, and then make sure it is enabled in your mixer. If your system has only a single sound card, enter hw:0,0 as the recording device in your recordMyDesktop configuration. And that's all you need to do.

What if you have a USB microphone? For one thing, you should be happy you don't have to crawl behind your PC and figure out where to plug in. The Linux kernel will give this a different name, most likely hw:1,0 if it's the second sound device. Run aplay -l to find out. (See Better Linux Sound Managment With ALSA, Part 2 for an in-depth ALSA howto, including identifying your sound devices.) Then start talking.

You Know Jack

The JACK audio connection kit is a power tool for serious audio users. It is a low-latency sound daemon that acts like a switchboard for all the sound streams in your computer. It is not a replacement for ALSA and other sound subsystems--it manages the streams coming in and out of your sound devices. recordMyDesktop supports JACK, so you can use it to configure your audio capture sources. Suppose you want to capture your sound card output, like we did last week with ALSA. Install JACK and its graphical control panel, qjackctl. This should appear in your multimedia menu as JACK Control. Fire it up and click the Connect button. You should see something like Figure 1. Click on Capture 1 and Playback 1, then the Connect button. Do the same for Capture 2 and Playback 2.

Now go to the Sound tab in recordMyDesktop, and make it look like Figure 2, with both of JACK'S capture devices selected. Start recordMyDesktop, and then open the Connect menu in JACK. You should see the new connections as in Figure 3.

If you can't record sound from your soundcard, you have a lot of company--it doesn't always work. I haven't figured out if it is some kind of kernel problem, a recordMyDesktop bug, a problem with low-end onboard sound, or what. I have found that recording from a microphone works every time.

JACK is probably overkill if you have only a single sound card. But when you have multiple sound devices it's a fast way to switch between them. Suppose you have a USB microphone, and you want to narrate your screencast. Go to the Setup menu in JACK and select your microphone as the recording source, as in Figure 4, and then select the JACK capture devices in recordMyDesktop. All done, and it doesn't change the sound settings for your computer.

YouTube, Here I Come

recordMyDesktop uses only Ogg Theora for video encoding, Ogg Vorbis for audio, and it's probably going to stay that way. There are Ogg clients for all platforms, but there will probably be situations that require you to convert to another format such as AVI or MPEG4. AVI, like Ogg, isn't a single codec, but a container for multiple audio and video codecs.

mencoder, which comes with MPlayer, is a good conversion tool with hundreds of options for manipulating your movies. This is a simple way to convert a video file with no audio:

$ mencoder videofile.ogg -ovc lavc -o videofile.avi
If it has an audio track, try this:
$ mencoder videofile.ogg -ovc lavc -oac lavc -o videofile.avi
videofile.ogg is your source file that you want to convert, and videofile.avi is the final, converted file. lavc, by default, converts Ogg Vorbis to MP3 format. ovc means "output video codec". oac is "output audio codec". lavc selects the libavcodec codecs for high video quality. You may also select other codecs--run mencoder -oac help and mencoder -ovc help to see your options.

If you need to resize your video, mencoder can do that too. For example, YouTube shrivels everything down to 320x240. The mencoder option is -vf scale=320:240.

Troubleshooting recordMyDesktop

Some problems with the audio capture device cause recordMyDesktop to hang during the encoding phase, and I've had to use SIGKILL to un-hang it because lesser measures don't work. First find the process number, then kill the poor thing:

$ ps ax | grep recordmydesktop
7231 ? Sl 0:02 recordmydesktop -o /home/carla/temp/fubble.ogg -fps 15 -x 371 -y 82 -width 1309 -height 921 -channels 2 -freq 44100 -device hw:0,1 -v_quality 63 -s_quality 10 -workdir /tmp --overwrite
$ kill -9 7231

On my system it complained of not being able to find libjack.so. Creating a soft link to give it the library name it wanted cured it:

# ln -s /usr/lib/libjack.so.0 /usr/lib/libjack.so

For some crashes it will create a crash log in your home directory, such as gtk-recordMyDesktop-crash.log.

Please visit the forums on SourceForge to give and receive help. Remember that the author of recordMyDesktop, John Varouhakis, is unavailable to maintain it for the rest of the year, so here is an opportunity for ace coders looking for something cool to do.

Resources

Carla Schroder is the author of the Linux Cookbook and the newly-released Linux Networking Cookbook, and is a regular contributor to LinuxPlanet.

Copyright Jupitermedia Corp. All Rights Reserved.