Gentoo Wiki



Kernel options

Note: The following kernel options were built into the kernel. They can also be built as modules

USB support

Make sure you have USB support in your kernel. Select OHCI HCD or UHCI HCD, depending on your motherboard's chipset. Use the lspci command to find out which one is right for you:

emerge -av pciutils
lspci -v | grep HCI

Select the proper option in the kernel. If you are not sure, there is no harm in enabling both of them:

genkernel --menuconfig all


cd /usr/src/linux
make menuconfig
Linux Kernel Configuration: USB Support
Device Drivers  --->
  USB support  --->
    <*>   OHCI HCD support
    <*>   UHCI HCD (most Intel and VIA) support

IEEE support

Note: The following is only necessary if it's a FireWire camera. This also means that you don't need the USB support above
Note: The following kernel options were built into the kernel. They can also be built as modules

Select the proper option in the kernel. If you are not sure, there is no harm in enabling both of them:

genkernel --menuconfig all
Linux Kernel Configuration: IEEE support
Device Drivers  --->
  IEEE 1394 (FireWire) support   --->
    <*>   IEEE 1394 (FireWire) support
    <*>   OHCI-1394 support
Linux Kernel Configuration: IEEE video support
Device Drivers  --->
  IEEE 1394 (FireWire) support   --->
    <*>   OHCI-1394 Video support

Download and install the vloopback module via svn

svn co vloopback
cd vloopback
mkdir -p /lib/modules/`uname -r`/kernel/drivers/misc
make install
Note: Vloopback requires v4l support, so be sure to activate it in the next section

Webcam support

Enable Video For Linux support in the kernel:

Linux Kernel Configuration: Video For Linux
Device Drivers  --->
  Multimedia devices  --->
    <*> Video For Linux

Note: if you are going to use a driver that uses the old V4L1 API (e.g. gspcav1), then you also need the "Enable Video For Linux API 1 compatible Layer" option checked. Otherwise the driver won't compile.

Webcam driver

To get information about your camera emerge usbutils and use lsusb to list usb devices. Example output:

# lsusb
Bus 001 Device 002: ID 046d:08da Logitech, Inc. QuickCam Messanger

Some of the available drivers have support for more than one type of camera chipset. Some cameras are based on a known chipset, even if the model is not listed. If you can't find your model in the list, try the drivers one after the other. One of them might work.

Konica, OV511, SE401, SN9C10x, STV680, W996[87]CF, some Philips webcams

Drivers for cameras based on these chip-sets can be found in the kernel. Some of these have better drivers in 3rd party packages. Continue checking this list for different drivers.


media-video/usb-pwc-re and media-video/usb-pwcx - Drivers for a variety of philips webcams called ToUcam (though not all of them).


A few drivers are available, each supports a different set of webcams. Logitech maintains a compatibility list here. You can find your device by its product id (PID). To find out the PID run lsusb and look at the code before your device name that looks like 046d:xxxx. The last four characters are the PID.

You can also try several drivers until you find the one that works best.

Note: Some old Logitech webcams only work with the Philips driver (e.g. Logitech QuickCam 4000 Pro, Logitech QuickCam Notebook Pro).

OV51X (Sony EyeToy)

The modules are:


OV51x driver for Linux which supports JPEG decompression. Newer version available on the package's site. More info available on the driver's homepage.

Ricoh R5U870

This USB webcam is found on some Sony Vaio SZ 13" laptops, the Vaio TZ and HP DV2000/DV6000/DV9000 Pavilion laptops.

Download the source and unpack it:

tar zxfv r5u870-<version>.tgz

You may have to enable

<*> Video For Linux -->
  [*] Video capture adapters  --->
    <M>   BT848 Video For Linux

Then install (as root):

cd r5u870-<version>
make && make install

The driver name is r5u870


There are a couple of sn9c1xx webcams around, like the sweex minicam. There is general support in the kernel for these, but there is a more up-to-date driver in the sunrise overlay.

layman --add sunrise
emerge sn9c1xx

Note: Do NOT forget to disable the driver in your kernel! They have the same name.


This webcam can be found in some ASUS laptops. A driver is in development. Latest version is available from SVN:

svn co syntekdriver

Compiling requires ctags installed:

emerge -n ctags
ln -s /usr/bin/exuberant-ctags /usr/bin/ctags

Compile and load the driver:

cd syntekdriver/trunk/driver
make -f Makefile.standalone
insmod stk11xx.ko

IEEE camera

This is written with Unibrain Fire-i in mind, but it could be easier or trickier with other cameras. Most IEEE cameras support IIDC so we use the the opensource driver. Coriander depends on it, and we need it to export the video to v4l. The thing here is that IEEE cameras give a stream of data that is not v4l: the data has to be converted to a v4l stream. This has to be done through a loopback daemon that continuously converts from /dev/video1394/0 into /dev/v4l/video0 and /dev/v4l/video1. For this to work, you will haveto have a) the vloopback driver in the kernel and b) either coriander or dc1394_vloopback acting as the daemon that does the conversion. Coriander is gui based and has a bunch of features like ability to show the video output by itself, save frameshots, send frameshots to some server through ftp, etc. For initial tests, it is more convenient while once everything is under control, it is easier to start the loopback service through the command-line tool dc1394_vloopback instead.

emerge coriander

You still need sys-libs/libraw1394 media-libs/libdc1394, but I am not sure if you need >=media-libs/libdc1394-2.0.0.

The command to start dc1394_vloopback2 is:

dc1394_vloopback2  --vloopback /dev/v4l/video0 --pipe --daemon

This will start the daemon that converts video stream between IIDC format to v4l format.

The default UDEV-configuration makes it a bit tricky. Remove the star after video[0-9]

File: /etc/udev/rules.d/40-video.rules
# video4linux
KERNEL=="video[0-9]",   NAME="v4l/video%n*", SYMLINK+="%k", GROUP="video"

This is important because else the video1394 is written as /dev/v4l/video0 and /dev/v4l/video1 , which the first two vloopback-devices also are called

Now you can load the modules

modprobe video1394
modprobe vloopback

Start up coriander, find a format in the services tab that works, and start v4l.

Kopete and AMSN needs a resolution of 320x240 to work with a webcam, so it's possible you want that resolution in coriander, or perhaps resized with some example apps which followed vloopback


If you can't identify the make or model or your webcam, try these drivers :

Loading driver

You should now have your camera's module installed (unless compiled into the kernel). To find the module's name of the module use the equery tool from gentoolkit with the name of the driver's package:

equery f <package name>

Insert the module for your camera.

modprobe <module_name>

If you are using udev there should now be a device file in /dev/v4l/ called videoN (one for each webcam). If the device is not created, check dmesg for errors and useful messages. To create devices manually use :

mknod /dev/video0 c 81 0

and repeat as needed for more devices, replacing both 0's with consecutive numbers.Set permissions as needed.


Some applications require the v4l and/or v4l2 use-flags to take advantage of your webcam. Some applications can't detect the camera's resolution. You can use the v4l-info tool from the media-tv/xawtv package to find out what resolution your device supports.

v4l-info | less

This produces a lot of output. Scroll through the list to find the resolution.


Versatile media player. Can play from many sources, including video devices. Specify the width and height manually, depending on what your camera supports. For example, with resolution of 352x288:
mplayer tv:// -tv driver=v4l:width=352:height=288:device=/dev/video1
mplayer tv:// -tv driver=v4l:width=352:height=288:outfmt=rgb24:device=/dev/video1:noaudio -flip
If using v4l2 supporting driver (ex: linux-uvc):
mplayer -fps 15 tv:// -tv  driver=v4l2:device=/dev/v4l/video0
(the -fps arg is needed because there is a bug in mplayer when playing back webcam using the media-video/linux-uvc driver)
Gtk1 application for viewing only. Able to manually save images on request. defaults to /dev/video so either make a symlink, or specify the correct device file on the command line using the -v option.
Modern version of gqcam.
Viewer for use with the spca5xx or gspcav1 driver.
One of the oldest video viewers for linux. Relatively old graphical interface. Gets the job done.
Rewrite of xawtv with added features.

Recording / Grabbing

emerge with the encode use-flag. Example usage for recording continuous video:

$ mencoder tv:// -tv driver=v4l:width=<width>:height=<height>:device=/dev/video0 -nosound -ovc lavc -o <filename>.avi

Recording with sound, one channel 64kbit mp3:

$ mencoder tv:// -tv driver=v4l:width=<width>:height=<height>:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o <filename>.avi

Able to capture single frames to image files.

Proprietary viewer that uses the UVC video module to capture video and images. Works with some problematic webcams.

A cheesy program to take pictures and videos from your webcam

Video Phone

See VoIP for a list of a number of Voice over IP applications. Skype is one of the most common applications using webcam -- remember that you need a version >=2.0.0. Also, with 64bit linux, there has been issues. Ekiga is another free video chat software -- it is easier to get it going, although presently, it can often crop out parts of the image if your camera is greater than 320x240.


emerge with the stream, httpd and v4l use-flags. Run the GUI client and open a capture device. Make sure the correct device file is selected, and turn on streaming at the bottom of the dialog. In the stream settings, enable http and select at least a video codec. In the preferences window you may also set a user and password for accessing the stream. The "open capture dialog" and "stream settings" will also show you the options you need to perform all this from the command line.

Streaming video server.

Note: If you know the following settings arn't needed, or can minimize this list, please do.

Specific setup for cameras based on PAC207* chipset:

Code: Pixart camserv setup
path            /usr/lib64/camserv/
device_path     /dev/video0
port            0
color           30000
hue             30000
contrast        30000
brightness      30000
whiteness       30000
autobright      0

video_section           video_v4l_qcam
width                   320
height                  240
maxfps                  0
memhack                 1

Streaming video server for Linux UVC compatible webcams with very low CPU and RAM usage.


Even though this is not a good idea due to usb bandwidth, this is possible with 1 or 2 cameras, or with multiple usb bus cards.

Motion detector.

Allows you to capture, analyze, record and monitor any cameras attached to your system through a web interface.

Not strictly a webcam application, but can be used in combination with a frame grabber to compare images and check for motion.

Troubleshooting and Tweaks

"Input/output error" or "No space left on device"

This can be due to USB bandwidth being exceeded. Try connecting the device to a different USB port, preferably on another bus (usually not the connector right next to it).

More info

Black screen

If you only see a blackscreen using xawtv or gqcam and then the application crashes and the kernel log gives you something like this:

May 18 14:47:37 [kernel] ohci_hcd 0000:00:03.1: leak ed ef3340c0 (#81) state 2
May 18 14:48:00 [kernel] quickcam: Control URB error -2
May 18 14:48:00 [kernel] Unable to handle kernel paging request at virtual address 02000040
May 18 14:48:00 [kernel]  <1>Fixing recursive fault but reboot is needed!

you have to make sure the webcam is connected to a usb-hub (BUS) that does not have any other devices attached to it. You can investigate that by issuing lsusb as root:

Here is the
root@localhost # lsusb
Bus 004 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 002: ID 046d:c50e Logitech, Inc. MX-1000 Cordless Mouse Receiver
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 002: ID 046d:0870 Logitech, Inc. QuickCam Express
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000

If lsusb hangs you need to reboot first (look at the line reboot is needed! in the kernel log). Here you see that Bus 002 only has the Logitech webcam connected to it. Before that it was connected to Bus 003 where there is already a n optical mouse and that would make it crash and I had to reboot the system. More about this issue can be found at Gentoo-forum and qc-usb mailing list

Odd colors

(Occures at least on logitech quickcam messenger 046d:08da) If using the gspca driver, try adding the parameter force_rgb=1. Either using modprobe manually, or add a file containing

Code: /etc/modprobe.d/gspca
options gspca force_rgb=1

Run update-modules force before inserting the module.

Logitech tweaks

If using the qc-cam driver, you can improve the speed of the camera using the qcset util. You can enable double-buffering using the command qcset compat=dblbuf. The qcset util is full of interesting settings. With qcset keepsettings=1, the settings will be stored into the webcam and you will be able to control brightness, contrast, etc. You can check that your settings have been correctly saved with the following command : qcset -i

Other resources


Retrieved from ""

Last modified: Mon, 22 Sep 2008 05:29:00 +0000 Hits: 87,481