Saturday 24 November 2007

How to configure webcam in Debian Linux

The friend of mine had been presented to me a webcam recently. On the box of Logitech QuickCam, there were logo of an alternative operation system, but in Debian configuration of a webcam is as easy as 1-2-3. Here are tips for configuration of a webcam.

Preparation
Some preparing words - if you didn`t compile your own kernel, this section can be omitted.
Webcam interface in kernel is almost like TVtuner - it is ordinary video device with /dev/video0 output. That`s why all articles about TVtuner configuration can help you as well. So, in kernel must be turned on:

  • v4l and all of it protocols (v4l monolithically, protocols - as modules)
  • i2c and it protocols (as well as during TVtuner configuration)
If it is enabled in kernel, you shouldn`t get any problems.


Installation
In the camera`s box was wrote: installation as simple as 1-2-3. So, I get pretty the same:

1. Installing software.
Instead of use of tonnes of proprietary garbage, let`s install from Debian repository:
sudo aptitude install gspca-source camorama
In the /usr/src directory, archive with driver source gspca-source.tar.bz2 will appear. Unpack it and change directory to /usr/src/modules/gspca and execute following:
make
Module must compile without errors. Next, do this:
sudo make install
This command will install your module in directory, were other kernel modules are placed. Optionally it can be executed:
sudo depmode -a
That`s itl, our goal is to load module of a webcam:
sudo modprobe gspca
Next step is to plug camera in USB and start the software.


2. Plugging the webcam
After you plug webcam into USB, it turns on green LED and in kernel logs should appear something like this:

usb 4-1: new full speed USB device using uhci_hcd and address 6
usb 4-1: configuration #1 chosen from 1 choice
/usr/src/modules/gspca/gspca_core.c: USB SPCA5XX camera found.(ZC3XX)
/usr/src/modules/gspca/gspca_core.c: [spca5xx_probe:3887] Camera type JPEG
/usr/src/modules/gspca/Vimicro/zc3xx.h: [zc3xx_config:515] Sensor ID:7
/usr/src/modules/gspca/Vimicro/zc3xx.h: [zc3xx_config:597] Find Sensor HV7131R(c)
/usr/src/modules/gspca/gspca_core.c: [spca5xx_getcapability:1165] maxw 640 maxh 480 minw 176 minh 144
usbcore: registered new interface driver gspca
/usr/src/modules/gspca/gspca_core.c: gspca driver 01.00.04 registered

It looks like the webcam had been recognised. Now the device file /dev/video0 must appear - this is actually our camera. After that, webcam's soft should be launched:
$ camorama
If all was done correctly, you should see video in a small window of Camorama. It can be something like this:


3. Start using the camera
Now you can use your cam in Wengophone for video conference with friends and colleagues. It is need to say that image processing from webcam consumes processor time very moderate, around 4-5% on my Pentium M 1.75 GHz laptop.

Besides video conferences in VoIP, one can turn fantasy on and find many interesting applications to webcam. You may use it as security camera or telemetric device: streamer program can grab pictures from it with a prescribed frequency.


Conclusion
Except that there were mentioned only RedmondOS, Logitech QuickCam Messanger webcam works great in Linux, and configured in same three steps minus tons of useless proprietaty garbage.

During the tweaking I used these great guidelines because of my custom-made kernel. Those who use distribution kernel, this guide may be helpful.

I am very grateful to my good old friend :-) for presented webcam - thanks a lot!

11 comments:

Anonymous said...

thanks, this document helped me while installing my Creative Live! WebCam on Debian etch..

virens said...

2 Anonymous пишет...
thanks, this document helped me while installing my Creative Live! WebCam on Debian etch..
I'm glad that my honest post helped you. Indeed, webcams in Linux are tuning in same way, just drivers are different.

Swagat said...

Thanks for your post. IT helped me to get my creative webcam VF0090 work on my debian etch. HOwever, I have few hiccups and I would be grateful if you can help me out.

First, I am getting a very low resolution 176x144. But it supports 352x288. How can change this resolution. Camera stops abruptly if I change the window size.

Secondly, it has a very small fps (3.5). I think it should have higher fps. How can I change the frame rate.

My system is a Pentium 4 machine with Debian Etch GNU/Linux 2.6.18-4-686 kernel.

virens said...

2 Insane said...
IT helped me to get my creative webcam VF0090 work on my debian etch.
Sure, gspca driver can support numerous of cameras.

HOwever, I have few hiccups and I would be grateful if you can help me out.
It's pretty difficult to do so, because I can't see logs of your system. :-)

First, I am getting a very low resolution 176x144. But it supports 352x288. How can change this resolution.
I'm sure it's a driver problem, because gspca is continuing to grow and getting more advanced in supporting of cameras. Consider to upgrade the kernel module (latest gspca).

Secondly, it has a very small fps (3.5).
The first thing I suspect is an old gspca version (probably shipped with distribution and, hence, outdated). Next thing - if you can, consider to upgrade the kernel (from packages or compiling by hands) - there are loads of changes and it's surely an improvements in V4L. May be a problems in V4L or I2C subsystems.

Unknown said...

It worked till the moment I typed command make. The result was:
make: *** No targets specified and no makefile found. Stop.
novica@novica-desktop:/usr/src/modules$
Is there any other idea:
I have Genius VideoCam Eye with Microdia chip and tried alsmost everything but no way. The best was blue very bad picture with Camorama.
I would be very glad if you can help.

Anonymous said...

Using module-assistant makes it much easier to install the gspca driver. After you install the gspca-source, module-assistant package, and the linux-headers package for your kernel, all you need to do is run this command:

m-a a-i gspca

or, in the long form:

module-assistant auto-install gspca

This will unpack the gspca files, compile the driver, and copy the resulting kernel module to the proper /lib/modules directory. No make or depmod to run at all.

Anonymous said...

> I have Genius VideoCam Eye with Microdia chip and tried alsmost everything but no way. The best was blue very bad picture with Camorama.
I would be very glad if you can help.

I have this camera working well with recent linux kernel (2.6.30) builtin gspca driver and command like this:
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so mplayer tv:// -tv driver=v4l:width=352:height=288 -flip -vf mirror,pp=hb/vb/dr/al

Anonymous said...

Still works with Lenny .. follow instructions .. thanks

MadCatMk2 said...

Anyone gotten this to work on Squeeze? I got gspcav1-20071224.tar.gz from mxhaard and tried both 'make' and '/gspca_build' with no luck. Here's the two outputs:
http://pastebin.com/f2b13ceb3

Anonymous said...

Great! It worked perfect with Logitech Connect and Lenny Stable.

Afonso said...

Thank you so much for you nice and clearer post!
I have tried several ways and i could not get my creative vista plus camera working! But now it is ok in Lenny stable. I still have to see about skype, but it works in camorama.

Best Regards

Afonso