Unable to read frames from VideoCapture from secondary webcam with OpenCV
Code: Simple example that works perfectly with primary webcam (device 0): VideoCapture cap(0); if (!cap.isOpened()) { std::cout << "Unable to read stream from specified device." << std::endl; return; } while (true) { // retrieve the frame: Mat frame; if (!cap.read(frame)) { std::cout << "Unable to retrieve frame from video stream." << std::endl; break; } // display it: imshow("MyVideo", frame); // check if Esc has been pressed: if (waitKey(1) == 27) { break; } // else continue: } cap.release(); Problem: I have a second webcam, which I'd like to use. However, when I replace VideoCapture cap(0);