Monday, March 18, 2013

Some useful webcam applications in XFCE

I've been trying out some useful applications in XFCE with my new webcam, a cheap but Linux friendly HP.

The first may not seem an obvious choice, but the only problem I had with the webcam was sound. The webcam has an internal microphone, but in some applications I couldn't hear it. mhWaveEdit is a sound recording application, which was able to record sound from the webcam, proving that the microphone did work. Knowing that it did work, I was able to get all the other applications I tried to work too (with a bit of perseverance!).


I first tried it with Pulseaudio, under which it picked up the microphone immediately, but later when I was investigating sound problems in other applications, I uninstalled Pulseaudio. Under Alsa, I had to enter the name of the webcam microphone, which is hw:1,0. To find the name of the webcam microphone, use this command:
arerecord -l
[Correction: the command should be arecord -l]

The microphone name is then hw:[card number],[device number].

In Skype the microphone worked under Pulseaudio and Alsa. In Pulseaudio it's just a question of making sure that the webcam microphone is set as the fallback microphone in Pulseaudio Volume Control, because Skype just sees the pulseaudio server; in Alsa, Skype sees the different possible inputs, and it's necessary to select the webcam microphone- fortunately the name in the menu was descriptive, telling me the make and model of the webcam as well as the system name, hw:1,0 again.

In Gnome I could use the webcam to take pictures and record videos with Cheese, and I wondered if I could do the same thing with an application in XFCE. I couldn't find a single application to do both, but it is possible to take pictures and record video.

Camorama is a simple application that let's you view the webcam output and take pictures, and it doesn't bring a cascade of dependencies on XFCE like Cheese.


The application does seem to be affected by a bug which makes it freeze immediately after opening, requiring a forced close, but it works fine if restarted. I am running Debian Testing (Wheezy), so maybe this bug will get fixed before the release. (GUVCView, reviewed later on, is also affected by this bug.)

It's possible to capture webcam video output with VLC, with which Debian XFCE comes installed, so first I gave that a try. There are plenty of tutorials for this on the web. Basically go to Media > Open capture device and select the webcam and microphone. The names in Linux are non-descriptive system names (hw:1,0 again- use the command above to check what the system names belong to). Windows versions of VLC seem to give a descriptive name to each input, telling you it's a webcam, and giving the manufacturer's name, but Linux users are less mollycoddled. To record video, hit the dropdown arrow next to play and select convert.

That's the theory, anyway. I found that video way recorded, but the sound track consisted mostly of scratches and crackles like a badly tuned short wave radio station. Google suggested trying plughw:1,0 instead of hw:1,0, but that didn't work with Pulseaudio.

Later on I tried again with no Pulseaudio and plughw:1,0 worked. A page on VORTEXBOX about the difference between hw and plughw gave me the clue I needed:
...unsupported sample rates will be converted to a working rate.
I tried dropping the sample rate in VLC and found that sound recording started to work. 11025 seems to be the highest that will work: the default is 48000.

The final application I tried is GUVCView. As mentioned before, this application is affected by the same bug as Camorama: when opned, it freezes within a few seconds, requiring a forced close, but when restarted it works without issue.

GUVCView did not work for me with the default settings, but after a lot of fiddling, it did. I had to find the right camera output setting by trial and error and for some reason the avi video format did not work but mkv did. Sound worked with the default or pulse inputs in Pulseaudio and the USB; with ALSA I had to select the HP 2200 USB hw:1,0 input.


2 comments: