I'm working a project where I need to display two video streams from two webcams. I was able to do this based on the GSVideo capture example
here, which I tweaked to make two capture objects and display them both. This works fine provided that the names of the cameras are unique. The problem is that the two cameras I want to use have the same Windows device name and conflict with each other. Both cameras are called 'USB 2.0 PC Camera' in GSCapture.list() which prevents me from using them simultaneously. Please help!!
Source:
GSCapture cam1;
GSCapture cam2;
public void setup() {
size(1280, 480);
String[] cameras = GSCapture.list();
if (cameras.length == 0)
{
println("There are no cameras available for capture.");
exit();
} else {
println("Available cameras:");
for (int i = 0; i < cameras.length; i++) {
println(cameras[i]);
}
cam1 = new GSCapture(this, 640, 480, cameras[1]);
cam2 = new GSCapture(this, 640, 480, cameras[2]);
cam1.start();
cam2.start();
}
}
public void draw() {
if (cam1.available() == true) {
cam1.read();
image(cam1, 0, 0);
}
if (cam2.available() == true) {
cam2.read();
image(cam2,640,0);
}
}
Runtime output:
GSVideo version: 1.0.0
Available cameras:
USB2.0 UVC VGA WebCam
USB 2.0 PC Camera
USB 2.0 PC Camera
1