Search code examples
windowsvideocamerastreamgstreamer

Gstreamer How to Capture Video from Specific Camera on Windows (MultipleCameras)


My problem is I have to capture video from camera but I have multiple cameras. First one is default laptop camera and second is USB-attached Camera.

The problem is there is no 'device' attribute in gstreamer sources on Windows.

In Linux, I have found " gst-launch v4l2src device=/dev/video0 \ "

In Windows instead of v412src, autovidesrc and videotestsrc are using. However, they don't have 'device' attribute.

As I searched in web, people are using dsvideoshowsrc but I did not get how they install it or how they implemented it. Some of them used ksvideosrc.



If anyone can help how can I resolve this issue, that would be very appreciated. I know many people had this problem and will have this problem. Therefore, clean explanation would benefit us so much.


Solution

  • I think dshowvideosrc is somewhat legacy, maybe helpful for some directshow only devices - I'm not even sure if that was ported to 1.0..

    ksvideosrc should be good for your webcams. For reference here is the code: https://github.com/GStreamer/gst-plugins-bad/blob/master/sys/winks/gstksvideosrc.c

    There you will see there are at least 3 different ways to select your device:

    PROP_DEVICE_PATH
    PROP_DEVICE_NAME
    PROP_DEVICE_INDEX
    

    So you can select your device via name or path - these may be GUIDs or something - I'm not sure (try to check within the code ;-)). But you also have an index which is probably the quickest way to get you started.