You won't get television-quality video with an inexpensive Webcam; you'll get small fuzzy herky-jerky. But it's acceptable herky-jerky. A low-end Webcam typically supports 15 frames per second at 320 x 240 pixels. For comparison, movies run at 24 fps. Spending a bit more money will get you some silky smooth video. One example is the Logitech QuickCam Pro 9000. For $99.99 you get a built-in microphone, autofocus, good-quality optics, 30 frames per second, and high-quality video capture size up to 960 x 720 pixels.
It takes more than a good Webcam to get good performance. You should have a modern PC, dual-core if possible, because all that video processing takes some horsepower. A typical minimum bandwidth requirement for smooth video is 256 kbps both ways.
Linux support for Webcams is pretty good, thanks to a number of hardy Linux developers. As usual, the vendors themselves have no interest in supporting anything but MS Windows. Michel Xhaard, with little help, figured out how to support over 250 different Webcams from a common base driver. This base driver, GSPCA/SPCA5xx, is now included in Debian and its offspring. The good folks at Linux UVC driver and tools support a different set of Webcams, and the nice people at Philips USB Webcam Driver for Linux keep it maintained, even though it supports mostly older devices.
If you're using an inherited Webcam, you may get lucky and it will work as soon as you connect it. Here is the short way:
- Install Camorama
- Install both v4l and v4l2 (Video for Linux)
- Connect Webcam
- Start Camorama
- Wave to yourself
Figure 1 shows a problem with integrated Webcams: you have to adjust your whole screen to frame your image. I was sitting tall, too.
Camorama does not support v4l2, which is unfortunate because v4l2 has a lot of improvements and bugfixes over version 1. The Ubuntu forums are full of users asking what the "could not connect to video device (dev/video0)" error message means when they try to use Camorama. One reason is they're using a driver that requires v4l2, or they don't have v4l installed.
On a modern Linux distribution, udev and HAL should detect the Webcam, create /dev/video0 with the correct permissions, owner root and group video, and load the correct kernel module. If you are not in the "video" group, add yourself, then logout and log back in. Run the id command with no options to make sure. Run lsmod to verify that the correct kernel module loaded.
$ lsusb Bus 005 Device 002: ID 04f2:b021 Chicony Electronics Co., Ltd $ dmesg [20093.973828] usb 5-8: new high speed USB device using ehci_hcd and address 2 [20094.211937] usb 5-8: configuration #1 chosen from 1 choice [20094.318310] Linux video capture interface: v2.00 [20094.341023] uvcvideo: Found UVC 1.00 device ViewSonic 1.3M, USB2.0 Webcam (04f2:b021) [20094.344865] usbcore: registered new interface driver uvcvideo [20094.345151] USB Video Class driver (v0.1.0)That reveals that this Webcam is supported by the uvcvideo kernel module, and if I need to do a Web search for more information I have the Super Secret Webcam Name and Number. Take that, Viewsonic! Remember that dmesg updates as you plugin or remove peripherals, so its most recent output always shows the latest activity. If dmesg doesn't see a device, then the kernel does not see it, and you're probably out of luck.
Come back next week and we'll get cracking on some fun stuff, such as spying on people and displaying ourselves on the Internet. Please visit Resources for all manner of helpful links.
- One man writes Linux drivers for 235 USB webcams
- Linux UVC driver and tools
- HOWTO Install a webcam. It's for Gentoo, but it has a lot of great information for all Linuxes
- Webcams on Ubuntu
- Set up your web cam on Debian Etch
- Linux and Logitech QuickCam Pro 9000
This article was first published on LinuxPlanet.com.