How to select the device-path for videosrc

Edgar Thier edgar.thier at theimagingsource.com
Thu Feb 23 13:15:22 UTC 2023


To open a device via a GstDeviceProvider use the GstDevice it offers:
https://gstreamer.freedesktop.org/documentation/gstreamer/gstdevice.html?gi-language=c#gst_device_create_element

The classes listed by a provider are just unsorted categories. "Video/Source" and "Source/Video" can be seen as identical.
They exist to allow for filtering (    gst_device_monitor_add_filter(monitor, "Video/Source/something", NULL); ).

I am not familiar with these source elements so i cannot comment on them specifically.
If you get muliple elements for a piece of hardware you can probably choose the first one and be fine.
Alternatively you will have to look at the offered properties to make decisions programatically e.g. device.api = mediafoundation.

- Edgar

________________________________
From: gstreamer-devel <gstreamer-devel-bounces at lists.freedesktop.org> on behalf of 张欣 via gstreamer-devel <gstreamer-devel at lists.freedesktop.org>
Sent: Thursday, February 23, 2023 07:21
To: gstreamer-devel at lists.freedesktop.org <gstreamer-devel at lists.freedesktop.org>
Cc: 张欣 <seanzhangxinsh at gmail.com>
Subject: How to select the device-path for videosrc

My laptop has 1 integrated cam, but when I run gst-device-monitor-1.0.exe to get device path, there are 2 device-paths for same device, and it seems one device-path is for ksvideosrc, it class is "class : Video/Source", the other one is for mfvideosrc, class is "Source/Video". My question is how to programally select a correct device for mfdevice? I pasted a part of output of "gst-device-monitor-1.0.exe" as below:
Device found:

name  : Integrated Camera
class : Video/Source
caps  : image/jpeg, width=1280, height=720, framerate=30/1, pixel-aspect-ratio=1/1
     ...
       image/jpeg, width=320, height=180, framerate=30/1, pixel-aspect-ratio=1/1
       video/x-raw, format=YUY2, width=1280, height=720, framerate=10/1, pixel-aspect-ratio=1/1
      ...
       video/x-raw, format=YUY2, width=320, height=180, framerate=30/1, pixel-aspect-ratio=1/1
gst-launch-1.0 ksvideosrc device-path="\\\\\?\\usb\#vid_174f\&pid_2435\&mi_00\#6\&1a775b38\&1\&0000\#\{6994ad05-93ef-11d0-a3cc-00a0c9223196\}\\global" ! ...

Device found:

name  : Integrated Camera
class : Source/Video
caps  : video/x-raw, format=BGR, width=1280, height=720, framerate=10/1, pixel-aspect-ratio=1/1
       video/x-raw, format=BGR, width=960, height=540, framerate=15/1, pixel-aspect-ratio=1/1
 ...
       video/x-raw, format=BGR, width=320, height=180, framerate=30/1, pixel-aspect-ratio=1/1
       video/x-raw, format=NV12, width=1280, height=720, framerate=30/1, pixel-aspect-ratio=1/1, colorimetry=1:4:0:1
       video/x-raw, format=NV12, width=960, height=540, framerate=30/1, pixel-aspect-ratio=1/1, colorimetry=1:4:0:1
...
       image/jpeg, width=320, height=180, framerate=30/1, pixel-aspect-ratio=1/1, colorimetry=1:4:0:1
properties:
device.api = mediafoundation
device.path = \\?\usb#vid_174f&pid_2435&mi_00#6&1a775b38&1&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\global
device.name<http://device.name> = Integrated Camera
gst-launch-1.0 mfvideosrc device-path="\\\\\?\\usb\#vid_174f\&pid_2435\&mi_00\#6\&1a775b38\&1\&0000\#\{e5323777-f976-4f5b-9b55-b94699c46e44\}\\global" ! ...

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230223/b94c8889/attachment.htm>


More information about the gstreamer-devel mailing list