How to open several cameras from the same USB port in Ubuntu

asked 2018-11-02 10:05:04 -0500


I have a headset with 3 cameras. One USB output. I am using Python 2.7 on Ubuntu 16.04 and OpenCv 3.3.1-dev I can't read from the 3 cameras at the same time that use the same USB port.

I have this error: vidioc_streamon: No space left on device

Do you know how I can solve this problem. I have tried with read(), grab()/retrieve(). Always the same error.

Thank You

edit retag flag offensive close merge delete


if the problem is bandwidth (one usb2 port can "just so" handle a single webcam), you can try to reduce the resolution of your cams.

(and 3.3.1 is quite old)

how does that device work, even ? does it concat 3 images to a single one ? (like e.g. a Zed does)

or do you try to access 3 VideoCaptures with 0,1,2 device id's ?

berak gravatar imageberak ( 2018-11-02 11:16:00 -0500 )edit

The resolution of the cameras are 200x200, 200x200 and 1280x720. Even if I only try with the two 200x200 cameras I have the same error. Maybe I could try to use a more recent OpenCV version. What is the more recent compatible version for Python 2.7?

I am trying to access with VideoCapture with 0,1,2 device id's. It works when I open only one. I tried with read, grab and retrieve. But I always have the same issue. I don't know if it concats 3 images in a single one.

Let me know if you need other informations. I am doing a project in a lab, and opening the 3 cameras at the same time is mandatory.

Thank you

PS: I am using this device:

valvador gravatar imagevalvador ( 2018-11-04 04:57:56 -0500 )edit

btw, is it usb2 or usb3 ?

i don't think, updating software will help (though pip has pretty recent releases),

sounds more like an usb bandwidth problem.

berak gravatar imageberak ( 2018-11-04 05:05:08 -0500 )edit

It is usb3. Yeah I agree. I think it is a banwidth problem. But I don't know how to handle it. Do you have any idea?

valvador gravatar imagevalvador ( 2018-11-05 03:13:20 -0500 )edit

sorry, not really.

berak gravatar imageberak ( 2018-11-05 03:26:06 -0500 )edit

I already met this vidioc_streamon: No space left on device error message. It caused by the underlying V4L driver, not OpenCV related.

It occurs when several cameras are connected, but it isn't a bandwidth problem (I had it with two webcams on different USB ports).

I don't remember how I solved it, google this error message for ideas for solutions.

kbarni gravatar imagekbarni ( 2018-11-05 09:58:27 -0500 )edit

Some more ideas: to be sure to open the same camera for the same variable, it's best to use the camera identifier in Linux (something like /dev/v4l/by-id/lefteyecamera) than the device number (0,1,2...).

You might also try to test the provided example code to see if the camera works with your hardware and then use their code as a base for your project. If you can get the image buffer, transforming it to OpenCV matrix or Numpy array is trivial.

kbarni gravatar imagekbarni ( 2018-11-05 10:11:00 -0500 )edit

I have already google this message error, but I haven't found any solutions.. What I know is that they are using uvc to open their cameras. I have tried but it didnt work for now. I have other issues. I will try with the camera identifier and I will let you know.

Ok, but how do you handle with this V4L driver? With their demo software they can open the 3 cameras at the same time, using uvc but I don't understand how

Thank you for your help

valvador gravatar imagevalvador ( 2018-11-05 15:02:12 -0500 )edit

Where/how do you find the camera indentifier in Linux?

valvador gravatar imagevalvador ( 2018-11-06 06:56:44 -0500 )edit

I success open the 3 cameras with uvc Library. Now I have an array of: (720,1280,3). How can I transform it into an OpenCV RGB Image?

valvador gravatar imagevalvador ( 2018-11-06 06:59:32 -0500 )edit