Problem with Multiple Identical Webcams

  • emkladil

    emkladil - 2009-11-06


    Thank you for a fine library for Processing - it was so much easier to get running than WinVDig.

    I am using GSCapture to display video from two web cameras for an installation I'm working on.  This worked fine in my initial testing (using an internal webcam on my notebook and an external Logitech QuickCam Pro 9000). 

    When I tried to use two identical Logitech QuickCam Pro 9000s, my program doesn't work.  I used the example program you included with the library to try capturing from the two cameras, but it only initiates capture with the first camera it finds.  The second camera does not initiate capture; it's indicator light stays off.

    I tested this setup outside of Processing with GSCapture, and Windows Explorer doesn't mind displaying both cameras simultaneously - so I know this is not a hardware problem.

    I've downloaded the source files for your library and looked in  Not knowing anything about how the underlying GStreamer library works, I am guessing that my program doesn't work because I send the same name twice (returned by the GSCapture.list() method) into the GSCapture constructor.

    Is there any way to refer to the capture devices by a unique handle? 

    I tried to set up Eclipse to debug into the code, but quickly found myself out of my depth when confronted with how to include your source .java files into the Eclipse workbench.  I've read the tutorial on creating libraries for Processing and the tutorial on configuring Eclipse for use with the Processing core.jar, but after that, I'm not sure what to do.

    Any assistance you could provide would be most welcome.

    Michael Chladil

  • emkladil

    emkladil - 2009-11-10

    Has anyone here successfully used identical web cams with the GSVideo library?

  • Andres Colubri

    Andres Colubri - 2009-11-10

    Hi Michael, sorry for replying earlier, but for some reason I didn't see your first post.

    I never found myself in the situation you are currently describing, which seems to point out to a conceptual defect in GSVideo (what to do when two cameras have the same name string).

    I'm quite busy with other things, so unfortunately I don't have time to look at this problem right now. After revising the code it seems the solution is not so simple. There is another property of capture devices which might be unique for each device (it is called device-index), the problem being I didn't include the handling of this property at the gstreamer level in order to be accessible by the GSCapture class. To do so I would need to recompile the capture plugin in gstreamer, repackage the gstreamer binaries that come with gsvideo, etc. For which I don't have the time at this moment.

    I'd suggest two temporal solutions:

    1) Use a GSPipeline to create the gstreamer pipeline that would allow you to choose the two cameras using the device-index. Something like this:

    cam0 = new GSPipeline(this, "ksvideosrc device-index=0 ! decodebin ! ffmpegcolorspace ! video/x-raw-rgb, bpp=32, depth=24");

    cam1 = new GSPipeline(this, "ksvideosrc device-index=1 ! decodebin ! ffmpegcolorspace ! video/x-raw-rgb, bpp=32, depth=24");

    I don't have two identical cameras to test this myself, but I tested with my built-in webcam and using device-index=0 finds the camera, otherwise there is no capture. This leads me to think it will work as expected with two cameras. Hopefully it will.

    2) Replace your second webcam by a different model :-)


Log in to post a comment.