how to find the device index of external camera for gstreamer?

gst-device-monitor-1.0 is displaying devices of class Audio/Source only. it does not display Video/Source devices at all,

In addition it fails when asking explicitly for video devices only.

gst-device-monitor-1.0 Video/Source Probing devices... 0:00:00.023973000 37488 0x7fce61d80350 WARN default gstdevicemonitor.c:465:gboolean gst_device_monitor_start(GstDeviceMonitor *):<devicemonitor0> No providers match the current filters Failed to start device monitor! 

however the following command works, so it can see the built in camera, and I have another one attached through USB.

gst-launch-1.0 avfvideosrc device-index=0 ! video/x-raw, framerate=30/1, width=1280, height=720 ! autovideosink 

Is there another way of finding out the device-index of the attached external camera, so that it can be passed to the avfvideosrc device?

gstreamer version:

 gst-launch-1.0 --version gst-launch-1.0 version 1.14.4 GStreamer 1.14.4 Unknown package origin 

Running on OSX: Sierra 10.12.6

2 Answers

It might be a bug. It works fine on Windows 10:

 gst-device-monitor-1.0 Probing devices... Device found: name : Realtek Digital Output (Realtek(R) Audio) class : Audio/Sink caps : audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]; audio/x-raw, format=(string)U8, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]; audio/x-ac3, framed=(boolean)true; audio/x-dts, framed=(boolean)true; properties: device.api = directsound device.guid = "\{4AC70C7D-F592-460B-98A2-EAAC3947DEE6\}" directsound.device.driver = "\{0.0.0.00000000\}.\{4ac70c7d-f592-460b-98a2-eaac3947dee6\}" directsound.device.description = "Realtek\ Digital\ Output\ \(Realtek\(R\)\ Audio\)" gst-launch-1.0 ... ! directsoundsink device="\{4AC70C7D-F592-460B-98A2-EAAC3947DEE6\}" Device found: name : Speakers (Realtek(R) Audio) class : Audio/Sink caps : audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]; ... etc ... properties: device.api = directsound device.guid = "\{5C211A4B-03A5-48DF-974A-E209146FDD9D\}" directsound.device.driver = "\{0.0.0.00000000\}.\{5c211a4b-03a5-48df-974a-e209146fdd9d\}" directsound.device.description = "Speakers\ \(Realtek\(R\)\ Audio\)" gst-launch-1.0 ... ! directsoundsink device="\{5C211A4B-03A5-48DF-974A-E209146FDD9D\}" Device found: name : Primary Sound Driver class : Audio/Sink caps : audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]; ... etc ... properties: device.api = directsound device.guid = "\(NULL\)" directsound.device.driver = "" directsound.device.description = "Primary\ Sound\ Driver" gst-launch-1.0 ... ! directsoundsink Device found: name : Microphone (Webcam C170) class : Audio/Source caps : audio/x-raw, format=(string){ S16LE, S8 }, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]; properties: device.api = directsound device.guid = "\{CF31A819-CCBA-47D4-A669-83CA42CE4DEB\}" directsound.device.driver = "\{0.0.1.00000000\}.\{cf31a819-ccba-47d4-a669-83ca42ce4deb\}" directsound.device.description = "Microphone\ \(Webcam\ C170\)" gst-launch-1.0 directsoundsrc device="\{CF31A819-CCBA-47D4-A669-83CA42CE4DEB\}" ! ... Device found: name : Primary Sound Capture Driver class : Audio/Source caps : audio/x-raw, format=(string){ S16LE, S8 }, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]; properties: device.api = directsound device.guid = "\(NULL\)" directsound.device.driver = "" directsound.device.description = "Primary\ Sound\ Capture\ Driver" gst-launch-1.0 directsoundsrc ! ... Device found: name : Webcam C170 class : Video/Source caps : video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, framerate=(fraction)[ 15/1, 30/1 ], pixel-aspect-ratio=(fraction)1/1; ... etc ... image/jpeg, width=(int)1024, height=(int)768, framerate=(fraction)[ 15/1, 30/1 ], pixel-aspect-ratio=(fraction)1/1; gst-launch-1.0 ksvideosrc device-path="\\\\\?\\usb\#vid_046d\&pid_082b\&mi_00\#9\&19fda08e\&1\&0000\#\{6994ad05-93ef-11d0-a3cc-00a0c9223196\}\\global" ! ... Device found: name : Microphone (Webcam C170) class : Audio/Source caps : audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)44100, channels=(int)1, channel-mask=(bitmask)0x0000000000000000; properties: device.api = wasapi device.strid = "\{0.0.1.00000000\}.\{cf31a819-ccba-47d4-a669-83ca42ce4deb\}" wasapi.device.description = "Microphone\ \(Webcam\ C170\)" gst-launch-1.0 wasapisrc device="\{0.0.1.00000000\}.\{cf31a819-ccba-47d4-a669-83ca42ce4deb\}" ! ... Device found: name : Speakers (Realtek(R) Audio) class : Audio/Sink caps : audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003; properties: device.api = wasapi device.strid = "\{0.0.0.00000000\}.\{5c211a4b-03a5-48df-974a-e209146fdd9d\}" wasapi.device.description = "Speakers\ \(Realtek\(R\)\ Audio\)" gst-launch-1.0 ... ! wasapisink device="\{0.0.0.00000000\}.\{5c211a4b-03a5-48df-974a-e209146fdd9d\}" Device found: name : Realtek Digital Output (Realtek(R) Audio) class : Audio/Sink caps : audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003; properties: device.api = wasapi device.strid = "\{0.0.0.00000000\}.\{4ac70c7d-f592-460b-98a2-eaac3947dee6\}" wasapi.device.description = "Realtek\ Digital\ Output\ \(Realtek\(R\)\ Audio\)" gst-launch-1.0 ... ! wasapisink device="\{0.0.0.00000000\}.\{4ac70c7d-f592-460b-98a2-eaac3947dee6\}" 

And

 gst-device-monitor-1.0 Video/Source Probing devices... Device found: name : Webcam C170 class : Video/Source caps : video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, framerate=(fraction)[ 15/1, 30/1 ], pixel-aspect-ratio=(fraction)1/1; ... etc ... image/jpeg, width=(int)1024, height=(int)768, framerate=(fraction)[ 15/1, 30/1 ], pixel-aspect-ratio=(fraction)1/1; gst-launch-1.0 ksvideosrc device-path="\\\\\?\\usb\#vid_046d\&pid_082b\&mi_00\#9\&19fda08e\&1\&0000\#\{6994ad05-93ef-11d0-a3cc-00a0c9223196\}\\global" ! ... 
1

On Linux, this is the behavior I see when I install only gst-plugins-base, and not also gst-plugins-good. You might also want to add -bad and -ugly.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like