[SOLVED] second webcam: Device or resource busy

*nix specific usage questions
umc
New Cone
New Cone
Posts: 2
Joined: 23 Mar 2010 11:44

[SOLVED] second webcam: Device or resource busy

Postby umc » 23 Mar 2010 12:12

Hello.

First of all, I'd like to say that I have read post viewtopic.php?f=13&t=56353 , and it didn't solve the problem for me.

I have two computers (same configuration, same operating system, same package versions) and on each of them I have 2 webcams connected (a4tech pk-335e).
I'm running Mandriva, kernel 2.6.31.5 on both of them, and vlc version 1.0.5. On both computers the cameras are /dev/video0 and /dev/video1.

On one computer the streaming works perfect for both cameras, but for the second one I can only get streaming for one or the other, never at the same time.

The commands I use for streaming are the following (on both computers):

Code: Select all

cvlc --color v4l2:///dev/video0 :v4l2-width=320 :v4l2-height=240 --sout="#transcode{vcodec=FLV1,vb=640,width=320,height=240}:std{mux=ffmpeg{mux=flv},access=http{mime=video/x-flv},dst=0.0.0.0:9000/stream.flv}" cvlc --color v4l2:///dev/video1 :v4l2-width=320 :v4l2-height=240 --sout="#transcode{vcodec=FLV1,vb=640,width=320,height=240}:std{mux=ffmpeg{mux=flv},access=http{mime=video/x-flv},dst=0.0.0.0:9001/stream.flv}"
The normal output for any of the webcams on any of the computers is:

Code: Select all

[webcam@computer1]$ cvlc --color v4l2:///dev/video0 :v4l2-width=320 :v4l2-height=240 --sout="#transcode{vcodec=FLV1,vb=640,width=320,height=240}:std{mux=ffmpeg{mux=flv},access=http{mime=video/x-flv},dst=0.0.0.0:9000/stream.flv}" VLC media player 1.0.4 Goldeneye [0x81be4f0] inhibit interface error: Failed to connect to the D-Bus session daemon: /usr/bin/dbus-launch terminated abnormally with the following error: No protocol specified Autolaunch error: X11 initialization failed. [0x81be4f0] main interface error: no suitable interface module [0x8120450] main libvlc error: interface "inhibit,none" initialization failed No protocol specified [0x81c11c0] main interface error: no suitable interface module [0x8120450] main libvlc error: interface "globalhotkeys,none" initialization failed [0x81c2fe0] dummy interface: using the dummy interface module... [0x81cc970] main access out: creating httpd
(I think the version is reported wrong, because in the Mandriva package manager I selected vlc 1.0.5 for installation)

on the first computer, if I start both streams, I get the same output, all is working properly, I can see both my streams. on the second computer though, I start the first stream, output is ok, but when I'm starting the second stream I get:

Code: Select all

[webcam@computer2]$ cvlc --color v4l2:///dev/video1 :v4l2-width=320 :v4l2-height=240 --sout="#transcode{vcodec=FLV1,vb=640,width=320,height=240}:std{mux=ffmpeg{mux=flv},access=http{mime=video/x-flv},dst=0.0.0.0:9001/stream.flv}" VLC media player 1.0.4 Goldeneye [0x884e648] inhibit interface error: Failed to connect to the D-Bus session daemon: /usr/bin/dbus-launch terminated abnormally with the following error: No protocol specified Autolaunch error: X11 initialization failed. [0x884e648] main interface error: no suitable interface module [0x87bc560] main libvlc error: interface "inhibit,none" initialization failed No protocol specified [0x884ecc8] main interface error: no suitable interface module [0x87bc560] main libvlc error: interface "globalhotkeys,none" initialization failed [0x884ecc8] dummy interface: using the dummy interface module... [0x8868aa0] main access out: creating httpd [0x8865438] v4l2 demux error: VIDIOC_STREAMON failed [0x8865438] v4l2 demux error: cannot set input (Device or resource busy) [0x886c5f0] v4l2 access error: VIDIOC_STREAMON failed [0x886c5f0] v4l2 access error: cannot set input (Device or resource busy) [0x88556d0] main input error: open of `v4l2:///dev/video1' failed: (null) [0x88556d0] main input error: Your input can't be opened [0x88556d0] main input error: VLC is unable to open the MRL 'v4l2:///dev/video1'. Check the log for details.
On the first impression, it looks like /dev/video0 and /dev/video1 point to the same camera, but when I start them individually, I can clearly see the output is different, each time from the proper camera. I tried connecting the cameras to different usb ports, but to no avail. The problem is still there.

Any ideas on what I could try to fix this problem ? It's really weird that in one place it works fine and in the second it doesn't.

Any help is greatly appreciated. Thanks for any ideas.
Last edited by umc on 30 Mar 2010 12:38, edited 1 time in total.

Rémi Denis-Courmont
Developer
Developer
Posts: 15323
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: second webcam: Device or resource busy

Postby Rémi Denis-Courmont » 26 Mar 2010 23:00

The error comes from the device driver here. Not much help to be expected from this forum.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

umc
New Cone
New Cone
Posts: 2
Joined: 23 Mar 2010 11:44

Re: second webcam: Device or resource busy

Postby umc » 30 Mar 2010 12:38

problem solved. it seems vlc doesn't like if both cameras are connected to the same usb controller. the fix came after I found a page (not sure if I'm allowed to post outside links, so I'll just quote) that described the following:
USB cameras
A USB camera uses all the bandwidth a USB1.1 controller can give. Even at low framerates the camera reserves more than half the 11 Mb/s. This means that the 2nd camera gets rejected. Few motherboards have more than one controller. Often 2 or 4 physical connections on a motherboard shares one and the same USB controller. To add more cameras you need to put USB adapter cards. One per camera. There exists cards with full bandwidth per USB socket. These present themselves as for example 4 USB controllers to Linux and they work fine with 4 cameras. Also, many (if not most) cheap PCI USB1/2 cards ($10 range) have a controller capable of supporting 2 x USB1 cameras and an additional USB2 camera per card. With those cards and USB1 extender cards (allowing extension of a USB1 device for up to 100m, typically 50m) you can have a capable surveillance setup using only USB cameras.
All I had to do was buy a PCI card that has some extra USB ports and connect one of the cameras there.

xj25vm
Blank Cone
Blank Cone
Posts: 15
Joined: 19 Aug 2010 22:01

Re: [SOLVED] second webcam: Device or resource busy

Postby xj25vm » 24 Aug 2010 23:50

I don't know if you are still watching this thread. I've spent the past week researching the issue of multiple webcams on the same usb controller (with most motherboards having one single controller for the 4-8 usb connectors). The amount of usb bandwidth a webcam needs is dependent on the resolution and the fps used. However, far more important in this case, is the fact that many recent v4l2/uvc webcams are capable of compressing the stream in mjpeg format and sending it down the usb cable ready compressed. By using either the "v4l2c:///dev/videoX" format, or the longer equivalent "v4l2:///dev/videoX:chroma=mjpg", you can force the camera to send the stream already compressed. If the USB controller is 2.0, I've managed to stream 4 cameras at 640x480, 10fps simultaneously using this technique - on a single USB controller.

The trouble is that some cameras (like MS LifeCam Cinema HD most notably) always ask for the maximum usb bandwidth - regardless of the resolution used, or using compression or not - which means that I've lost days testing and was almost convinced that I couldn't get streaming more then one camera per usb controller - until I found that bit of information on the uvc-devel list.

Hope the above helps somebody save a bit of time.

vale4674
Blank Cone
Blank Cone
Posts: 32
Joined: 29 Sep 2011 12:50

Re: [SOLVED] second webcam: Device or resource busy

Postby vale4674 » 29 Nov 2011 18:51

I don't know if you are still watching this thread. I've spent the past week researching the issue of multiple webcams on the same usb controller (with most motherboards having one single controller for the 4-8 usb connectors). The amount of usb bandwidth a webcam needs is dependent on the resolution and the fps used. However, far more important in this case, is the fact that many recent v4l2/uvc webcams are capable of compressing the stream in mjpeg format and sending it down the usb cable ready compressed. By using either the "v4l2c:///dev/videoX" format, or the longer equivalent "v4l2:///dev/videoX:chroma=mjpg", you can force the camera to send the stream already compressed. If the USB controller is 2.0, I've managed to stream 4 cameras at 640x480, 10fps simultaneously using this technique - on a single USB controller.

The trouble is that some cameras (like MS LifeCam Cinema HD most notably) always ask for the maximum usb bandwidth - regardless of the resolution used, or using compression or not - which means that I've lost days testing and was almost convinced that I couldn't get streaming more then one camera per usb controller - until I found that bit of information on the uvc-devel list.

Hope the above helps somebody save a bit of time.
MY HERO!!!! :D:D:D:D This is solves the problem for me!

xj25vm
Blank Cone
Blank Cone
Posts: 15
Joined: 19 Aug 2010 22:01

Re: [SOLVED] second webcam: Device or resource busy

Postby xj25vm » 29 Nov 2011 20:33

Just in case somebody else will find this useful. The list of cameras which hog the entire USB bandwidth (regardless of fps, resolution or compression used) has expanded to include MS LifeCam Studio and apparently Logitech C910. I don't know for sure about Logitech C910 - I've just seen reports online of the problem. But I have 5 MS LifeCam Studio - and, although they are great cameras - a single one will saturate the USB root hub regardless of settings used, making it impossible to use more then one at a time on the same usb root hub.

There has been some discussion on the Linux uvc-devel list about this problem - and there are some proposed patches to work around this bug - but nothing officially approved I'm afraid.

Rémi Denis-Courmont
Developer
Developer
Posts: 15323
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: [SOLVED] second webcam: Device or resource busy

Postby Rémi Denis-Courmont » 29 Nov 2011 21:38

It's simple really. The USB2 bandwidth is 480 MBits/s. Now consider 16 bits per pixel times the width times the height times the frame rate. At 720p, you'll max out the whole USB bus at 32 fps. At 1080p, 14 fps.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 39 guests