We are trying to simultaneously run 6 cameras on a Raspberry Pi 3B+ with an add-on 4 port USB hub that has an external power supply. The cameras are set at 15 FPS with a colour image size of 640 X 480. I found that it just works properly when I opened 2 cameras simultaneously. When I add a third camera I get this error message: "select timeout".

Below is the test code I'm using :

import cv2
import sys
print sys.argv
if len(sys.argv) < 2:
    print "Usage : > python video.py [camno1] [camno2]"
cam = []
cap = []
for i in range(len(sys.argv) - 1):
while True:
    for i in range(len(cam)):
        print "cam"+str(i)+" read"
        ret, frame = cap[i].read()
        if ret :
            cv2.imshow("frame"+str(i), frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
for i in range(len(cam)):

My goal is to get a still image from each camera, one-by-one, and I don't need higher than 15 FPS. When I try to open/read and close each camera, one-by-one, it takes too long to start them all (around 1.5 sec per camera) so that the total time is more than 10 secs. So I am looking for a solution to either keep all 6 cameras open at the same time or to speed up the: open/read/close times for each camera so that my total rotation time is around one second. Anyone have any ideas?

  • I wouldn't be surprised if that data rate from 6 cameras at once was more than the USB alone can handle, but I haven't done the calculations. Even if the USB bus could handle the throughput, that's 6 different devices trying to send data. – T. M. Jan 5 at 1:15
  • Welcome to Raspberry Pi! Please take the tour and visit the helpcenter to see how things work here. Could you please provide a datasheet of the cameras (or at least make&model)? Do you know what colordepth the images have and what compression settings are available/selected? – Ghanima Jan 6 at 15:09

640x480 Pixel at 24 Bit (guessing here) has an uncompressed size of 1 MB. At 15 FPS that would be 15 MB/s per camera. Six cameras for a total of 90 MB/s. That would be outside the realm of the possible. Expect a net data rate in the range of 35 to 40 MB/s at best (see here and here).

If we, however, assume a compression ratio of 1:10 (which would seem reasonable for JPG) that could be as less as 9 MB/s and well within a reasonable range for the Pi's USB 2.0 ("Hi-Speed"). But it all depends on bandwith requirements of the cameras (compression setting, colordepth) and protocol overhead. Not to mention the processing of the captured images - I take it the Pi is supposed to do something meaningful with those images.

  • Thank you for your analysis. We ran the same numbers as you did regarding the compression ratio and are baffled at why we can only turn on two cameras at the same time. It would be OK if we could cut down the start-up sequence to 0.2 seconds per camera instead of the present 1.5 seconds. We are doing pattern recognition on a 360 degree scan and 10+ seconds is just too long. – tony holland Jan 8 at 20:20

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.