I had the same problem with two Digitus webcams and the same resolution. Most likely this is because the resolution, framerate and protocol used by your cameras overloads the USB 2.0 connection. Even USB 3.0 might not help here depending how your USB hardware is run internally. Most webcams you can buy are USB 2.0 only and that means the protocol is USB 2.0 even on a USB 3.0 host (backward compatibility).
The easiest fix is to put them on two different USB 2.0 hosts. With lsusb
you can find out to which bus you're cameras are attached to. Make sure they don't have to share - especially with USB 1.0 hardware like keyboards and such.
The next thing you can do is to change the protocol used by the cameras. With
v4l2-ctl -d /dev/video1 --list-formats-ext
you can list the different protocols you're camera understands. In my case there where two pixelformats: YUYV
and MJPG
. The latter one uses less bandwith on the USB connection but added more lag in my connection. Guvcview
does a good job in Ubuntu to try different protocols. Be sure to switch to tab "video & files" - there you can change the frame rate, pixel format and other things related to the format.
Getting the exact settings to work with OpenCV is a different story though. I use OpenCV 2.4.3.2 and had to patch the sources to be able to correctly set framerate and resolution for my 2x PS3-eye cameras. When I cleaned up a little bit I will try to submit a patch.