简体   繁体   中英

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.

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.

ksvideosrc is good. Need to have GStreamer version 1.3 or above. Install or change to use all capture features. Typical install on windows does not come with ksvideosrc . For ksvideosrc device-index starts from 0. If Webcam is the only video capture device, it would be device-index 0.

This worked for me

gst-launch-1.0.exe -v ksvideosrc do-stats=TRUE ! videoconvert ! autovideosink

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM