I would like to connect 2 usb webcams to a RaspberryPI and be able to get at least 1920 x 1080 frames at 10 fps simultanously. This will be done using OpenCV. Has anyone done this and knows if this is possible? I am worried that the PI has only 1 usb bus?? (usb2) and might get a usb bandwidth problem.

Currently I am using an Odroid and it has a usb2 and usb3 bus so I can connect 1 camera to each without any problemo..

EDIT: I guess my follow up question would be how many USB buses are on the RPI 3 because if there is 2 then I can put 1 camera on each bus.

  • As in the answer below, data rate may be sufficient, but what is not talked about is can you process 20 fps with opencv, and that depends on what you are doing with them. But my guess is going to be no, you cannot.
    – Chad G
    Apr 20 '18 at 23:31

This might not constitute an answer but the Raspberry Pi (any currently existing one) only has one USB 2.0 bus - the ones with more than one USB port provided the extra ports with a Hub chip that also provides the Wired Ethernet on the B models.

The Compute Module might be a little different but as that is often used by hobbyists with its development kit into which it plugs and it is the latter that provides the normal physically ports into which things are plugged I think it has to be excluded from the discussions.

I think you will have to do the maths to estimate whether your requirements are feasible - don't forget that as well as the resolution the colour/greyscale resolution also acts as a multiplier on the data-rate 24 bit colour (using 2^8 levels for each of red/green/blue) uses more than something that uses a lesser number or encodes the video data in a more complex manner in order to reduce the data-rate at the cost of lowering the resolution of the chrominance component of the data (with a split between a luminance (Y) and two colour components (Cr & Cb) and less bits allocated to the latter).

Whilst looking for clues about this I found "What bitrate should I use when encoding my video? How do I optimize my video for the web?" which describes a Kush gauge which is:

pixel count x motion factor x 0.07 ÷ 1000 = bit rate in kbps
(frame width x height = pixel count) and motion factor is 1,2 or 4

applying this to your proposed usage for the worst motion factor:

(1920 x 1080) pixels x (10) frames per second x 4 x 0.07 ÷ 1000 = 5806 kbps

i.e. 5.8Mbps per image. Well USB2 is supposed to be good for 480Mbps but in practice (Wikipedia) with bus access constants this is more like 280Mbps or 35MBytes-per-second. So USB2 should be good enough as far as I can see, for several comeras...

  • i usually use trial and error in that i plug in as much camera as i can before it crashes which is usually 1 or 2 then i make 1 less camera and so on..
    – bakalolo
    Dec 30 '17 at 21:05
  • The unanswered bit though is what sort of colour depth (and I suppose the encoding of the video information) is used, more complex encoding (within the cameras) usually means less raw data to shift over the USB (although further transcoding by the RPi with the image data in order to display it could factor into things overall)...
    – SlySven
    Dec 31 '17 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.