Friday, March 9, 2012

Working with a webcam

I am currently working on a project to monitor road traffic from cameras. As a result I am playing with OpenCV (and ROS). I bought 2 Altair USB webcams and got problems with them.

Here are some tools to playback video:
- cheese
- xawtv -v 1 -c /dev/video0
- luvcview -d /dev/video0
- mplayer tv:// -tv driver=v4l2:device=/dev/video1

In particular, luvcview has a nice GUI that allows to control video parameters, which turned out to be necessary to turn off the auto exposure mode and adjust it manually.

I had this problem where it was impossible to playback video from both of them at the same time. The solution was to set an option in the uvcvideo driver:

sudo rmmod uvcvideo
sudo modprobe uvcvideo quirks=128
 
This will be reset every reboot. If this works, create the following file:
 
sudo vi /etc/modprobe.d/uvcvideo.conf 

containing the line:

 
options uvcvideo quirks=128
 
reference: http://renoirsrants.blogspot.com/2011/07/multiple-webcams-on-zoneminder.html 

3 comments:

  1. What should I do if I want to connect 4 webcams to the same port, using a usb hub?. quirks=128 doesnt work

    ReplyDelete
  2. You must use MJPEG compression format for the camera to lower the bandwidth or use different USB controller/card.

    ReplyDelete
  3. Hi,

    I'm trying to run two webcams with compression (h264 from Logitech C920) on the same USB2 hub and it fails. I checked (with Wireshark) actual bandwidth is 1 MB/sec, nevertheless I'm getting failure when I try to stream from two webcams simultaneously. Do you have a tip how to overcome that?

    Thanks!

    ReplyDelete