Document Actions

How to install the Webcam Tools (libwebcam, uvcdynctrl)

Explains how to compile and install libwebcam and uvcdynctrl from the source code contained in the webcam-tools package.

Purpose

This how-to contains step-by-step instructions for installing the Webcam tools, consisting of the libwebcam library and the uvcdynctrl tool.

If you are an advanced user you may prefer to directly get the code from the SVN repository (the trunk version is recommended) and read the README file.

Prerequisities

To follow this how-to you will need either Debian or Ubuntu Linux (both 32-bit and 64-bit work). For Ubuntu version 8.04 (Hardy) or newer is recommended. If you are using an older or different distribution you may need to slightly adapt certain commands.

Make sure you are able to use sudo to run certain commands to update packages and install software with administrator permissions.

Step by step

1. Install the prerequisites.

sudo aptitude install subversion cmake build-essential libxml2-dev pkg-config gengetopt

If you are running Ubuntu 8.04 you need to enable the hardy-backports repository in /etc/apt/sources.list before installing the cmake package because Ubuntu 8.04 ships with CMake 2.4 by default, while CMake 2.6 is required for this how-to. The hardy-backports repository makes CMake 2.6 available on Ubuntu 8.04.

2. Retrieve the latest webcam tools code from the Subversion repository.

svn co http://svn.quickcamteam.net/svn/qct/webcam-tools/trunk webcam-tools

3. Download and extract the sources for the Linux kernel and the UVC driver (uvcvideo).

If you are running kernel 2.6.26 or later the UVC driver is already part of your kernel, so you can install the kernel sources using APT. Make sure you install the same version that you are currently running (type uname -r in the shell if you are unsure about your kernel version). For example, if you are running kernel 2.6.32 replace the xx with 32 in the following example):

sudo aptitude install linux-source-2.6.xx
cd /usr/src
sudo tar xfj linux-source-2.6.xx.tar.bz2
cd -

If you have compiled the UVC driver manually, probably because your kernel is 2.6.25 or older, you already have the necessary files on your computer.

4. Find the directory where the UVC driver's uvcvideo.h header file is located.

sudo updatedb
locate uvcvideo.h

If you have installed the linux-source-2.6.xx package in the previous step the path should be something like this:

/usr/src/linux-source-2.6.xx/drivers/media/video/uvc

5. Prepare the build process. (Replace uvcvideo_path with the directory name found in step 4. Be sure not to include the trailing "uvcvideo.h".)

cd webcam-tools
mkdir build
cd build
cmake .. -DCMAKE_INCLUDE_PATH=uvcvideo_path -DCMAKE_INSTALL_PREFIX=/usr

If there are any errors at this point you need to fix them before continuing. Be sure to consult the README file that comes with the webcam-tools package.

Notes:

  • Warnings, e.g. about V4L2_CTRL_TYPE_STRING not being supported, are safe to ignore.
  • If you don't want to install the software into /usr/ but the default /usr/local/ directory simply omit the CMAKE_INSTALL_PREFIX part. Please only change this if you know what you're doing though; you may get errors about libwebcam not being found when you try to run uvcdynctrl.

6. Build everything.

make

7. Install libwebcam and the tools on your system.

sudo make install

That's it!

Your system now has libwebcam and uvcdynctrl installed. If you have any webcam devices connected you can run the following command to see a list:

$ uvcdynctrl -l
Listing available devices:
  video0   UVC Camera (046d:0994)

Or, if you don't have a camera connected yet:

$ uvcdynctrl -l
Listing available devices:
No devices found.

Either way, if the command works you have successfully completed the installation and you can now use uvcdynctrl to control your camera settings. Type uvcdynctrl -h to see what you can do with it.

Further information

If you have any questions or feedback please feel free to visit the Webcam library forum.

by Martin Rubli last modified 2010-01-10 22:44
Powered by Plone CMS.