Say Cheese
Tuesday, January 1st, 2008It’s new year, 2008. Time to smile
Few days ago, I’ve been playing around with a pretty old USB webcam. I just plugged in it, and v4l(Video for Linux) drivers detected that fine (”dmesg | tail” would do the trick for checking what has been going in the system).
Since I don’t any specific webcam capture apps, I just used VLC to do some little testing. By running “vlc v4l:/dev/video0″, the green light on the top of the webcam turned on (turning on a small smile on my face
) and the video showed up. But it was about 60×60 size (and the smile faded away). So, I experimented with several sizes, and the best worked so seemed to be “320×240″.
Now, assuming that it’s enough for my needs (I don’t really need this anyway), I decided to install a webcam app. The “Cheese” from gnome foundation looked promising, So, I downloaded the code, compiled and installed it. bham, there is nothing, just the gtk widget background with a gnome hand imprinted.
I guessed that the both problem and solution should lie in the gstreamer settings. So, I downloaded and installed the newest stable version of gstreamer(0.10.15), plugins-base(0.10.15), plugins-good(0.10.6) and plugins-ugly(0.10.6). But as a matter of fact, it didn’t have any effect on “Cheese”, but to break my mp3 playing capabilities of totem. Later on I found out it’s due to some plugins aren’t not compiled to properly, so compiling them fixed the mp3, but not the webcam app.
However, after going through the Cheese FAQ, I found out that I have to set some properties from the gstreamer-properties dialog and just blaming myself for not thinking of checking FAQ before going to all the hassle of compiling gstreamer, I changed the settings as it said (ximagesink something – I can’t remember now), then fired up Cheese.
Whoa, the webcam is blinking and suddenly the video appeared. But their seems to be small problem with the video, 3/4 of the image is blank. Only top 1/4 is displayed properly. First, I though it’s a temporarily problem, so I did a “rmmod and modprobe” to reset the device, but it didn’t help. So, I fired up cheese from the command line to see what’s going on. First it was detecting the webcam, then the sizes it can support (in other words the available “modes”). Then, it’s selecting so called the best mode, which is the largest.
For my webcam that was a weird size something with 288 x XXX (Sorry I can’t remember that either now). So, I tried that size with the VLC, and it’s the same results. As you can guess it’s not a problem with gstreamer but the V4L drivers. I looked for any cheese configuration file to set the preferred “mode” of the webcam, but unfortunately the product is still very young.
I didn’t want to mess with the V4L drivers, so I had a look at the Cheese source code. There is an universal truth about everything, it’s always easier to break things rather than fix them. So, I just break the webcam mode detection code which leads into my hardcoded preferred webcam settings. Changes are done in cheese-webcam.c, and here is the diff file – just in case.
Now, It’s time to say Cheese, and Happy New Year!

