Using multiple USB webcams in Linux
- by rachelderp
Running more than one USB webcam in Debian/Linux results in the the following error:
libv4l2: error turning on stream: No space left on device
VIDIOC_STREAMON: No space left on device
What initially seemed to be a programming issue in OpenCV turned into a quest for a mysterious hardware/software problem after the same errors were produced by running cheese and xawtv.
Apparently it's caused by webcams requesting all the available bandwidth on the USB host controller. With that in mind I decided to run wireshark and capinfos to see just how much bandwidth a single camera used.
4 megabits per second at 320x240
14 megabits per second at 640x480
32 megabits per second at 1920x1080
Interesting! That might explain why two cameras at 320x240 work but any higher resolution fails. It's as if my USB controller is only operating at USB 1 speeds, yet lsusb shows both webcams belonging to a device which supposedly supports 480 megabits per second.
One solution proposed forcing the webcams to calculate their bandwidth usage instead of requesting their maximum by running the following commands:
sudo rmmod uvcvideo
sudo modprobe uvcvideo quirks=128
Unfortunately that made no difference, so I decided to try another solution. A post on StackOverflow suggested telling my webcams to use a lower FPS or compressed video format like MJPEG, but after running v4lctl list it doesn't appear either of my webcams support changing their video mode.
And that's where I'm stuck. Why would two webcams operating well below the maximum speed of USB 2 would produce this error?
ps: It's not a disk space issue, df displays no change when the webcams are started.
pps: If it makes a difference, here's the output of lsusb