I'm running a Ubuntu 14.04 LTS on my RPi 2. I've OpenCV 2.4.9 installed on it. While running a simple camera capture program works fine.

Here is a code for it.

import numpy as np
import cv2
from time import time

cap = cv2.VideoCapture(0)
cap2 = cv2.VideoCapture(1)
frame_count = 0
    # Capture frame-by-frame
    start_t = time()
    ret, frame = cap.read()
    #ret2, frame2 = cap2.read()
    end_t = time()
    time_diff = (end_t - start_t)
    print 'Diff is : %f ms\n' % (time_diff * 1000)


But if I remove comments from the line #ret2, frame2 = cap2.read() to enable getting feeds from the other camera, it takes a lot of time to capture a frame (10 sec or something). Has anyone faced similar problem ? I tested the same program on my ubuntu 15.04 laptop. It works fine on my laptop.

Additional info :

Output of lsusb.

Bus 001 Device 006: ID 046d:0825 Logitech, Inc. Webcam C270
Bus 001 Device 005: ID 046d:082b Logitech, Inc. 
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Also, sometimes I get this error when I dig in /var/log/syslog It's not regular though.

ubuntu kernel: [  952.746104] uvcvideo: Failed to resubmit video URB (-1).

Update :

While forcing webcam resolutions to 320x240 by

cap.set(3, 320);
cap.set(4, 240);
cap2.set(3, 320);
cap2.set(4, 240); 

It works fine. Does it have anything to do with v4l2 or something ?

1 Answer 1


Looks like it may have been a USB bandwidth problem. Streaming two webcams at the same time may be beyond the RPi 2's capability, and it would explain why it worked on a laptop. That would also explain why dropping the resolution would allow it to work.

  • 2
    This is not a definitave answer, merely a speculation. It'd be more appropriate to post this in a comment.
    – user96931
    Commented Dec 27, 2019 at 17:59
  • This was the problem in my case, and was solved by lowering the video bitrate of the camera to avoid hitting the USB2 bandwidth limit. Another hint that this was the problem was that streaming would work when there was little change in the video (e.g. overnight when the frame was mostly dark) and the Failed to resubmit video URB errors would only appear during the daytime when more video bandwidth was required.
    – Malvineous
    Commented Dec 30, 2021 at 2:40
  • So maybe it's a USB bandwidth problem, but why? Actually, "how do we get around it?" is a better question. In OP, frames are being grabbed one-at-a-time from alternating cameras. It's not obvious to me why this would overload USB. First we grab one frame from one camera. Then grab a frame from the other camera.
    – bfris
    Commented Apr 20, 2022 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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