dshowvideosrc Unable to grab frames from OBS studio virtual camera
Describe your issue
OBS studio allows to create a virtual camera by using the DirectShow API, the camera should be detected and used only by using the DirectShow API.
Using the directshow plugin from mainline it is possible to detect the camera by using the gst-device-monitor-1.0 tool
Device found:
name : OBS Virtual Camera
class : Video/Source
caps : video/x-raw, format=I420, width=1920, height=1080, framerate=30/1
video/x-raw, format=YUY2, width=1920, height=1080, framerate=30/1
gst-launch-1.0 dshowvideosrc device="\@device:sw:\{860BB310-5D01-11D0-BD3B-00A0C911CE86\}\\\{A3FCE0F5-3493-419F-958A-ABA1250EC20B\}" device-name="OBS\ Virtual\ Camera" ! ...
However the dshowvideosrc is not able to capture frames this virtual device. No issue is reproduced when using a real webcam.
The issue can be reproduced with gst-launch-1:
gst-launch-1.0 -v -m dshowvideosrc device="\@device:sw:\{860BB310-5D01-11D0-BD3B-00A0C911CE86\}\\\{A3FCE0F5-3493-419F-958A-ABA1250EC20B\}" device-name="OBS\ Virtual\ Camera" ! videoconvert ! queue ! autovideosink
Use Windows high-resolution clock, precision: 1 ms
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Got message #16 from element "autovideosink0" (need-context): GstMessageNeedContext, context-type=(string)gst.d3d11.device.handle;
Got message #17 from element "autovideosink0" (have-context): GstMessageHaveContext, context=(GstContext)NULL;
Got context from element 'autovideosink0': gst.d3d11.device.handle=context, device=(GstD3D11Device)"\(GstD3D11Device\)\ d3d11device2", adapter=(uint)0, adapter-luid=(gint64)278477, device-id=(uint)39745, vendor-id=(uint)32902, hardware=(boolean)true, description=(string)"Intel\(R\)\ UHD\ Graphics";
Got message #20 from element "autovideosink0-actual-sink-d3d11video" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)void-pending;
Got message #21 from element "autovideosink0" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)void-pending;
Got message #22 from element "queue0" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)void-pending;
Got message #23 from element "videoconvert0" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)void-pending;
Got message #24 from element "dshowvideosrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)void-pending;
Got message #25 from element "pipeline0" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)paused;
Got message #28 from pad "queue0:src" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)create, owner=(GstElement)"\(GstQueue\)\ queue0", object=(GstTask)"\(GstTask\)\ queue0:src";
Got message #29 from element "queue0" (state-changed): GstMessageStateChanged, old-state=(GstState)ready, new-state=(GstState)paused, pending-state=(GstState)void-pending;
Got message #30 from element "videoconvert0" (state-changed): GstMessageStateChanged, old-state=(GstState)ready, new-state=(GstState)paused, pending-state=(GstState)void-pending;
Got message #32 from pad "queue0:src" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)enter, owner=(GstElement)"\(GstQueue\)\ queue0", object=(GstTask)"\(GstTask\)\ queue0:src";
Got message #34 from pad "dshowvideosrc0:src" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)create, owner=(GstElement)"\(GstDshowVideoSrc\)\ dshowvideosrc0", object=(GstTask)"\(GstTask\)\ dshowvideosrc0:src";
Got message #35 from element "dshowvideosrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)ready, new-state=(GstState)paused, pending-state=(GstState)void-pending;
Got message #36 from element "pipeline0" (state-changed): GstMessageStateChanged, old-state=(GstState)ready, new-state=(GstState)paused, pending-state=(GstState)void-pending;
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Got message #37 from pad "dshowvideosrc0:src" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)enter, owner=(GstElement)"\(GstDshowVideoSrc\)\ dshowvideosrc0", object=(GstTask)"\(GstTask\)\ dshowvideosrc0:src";
Got message #38 from element "pipeline0" (stream-start): GstMessageStreamStart, group-id=(uint)1;
Got message #43 from pad "dshowvideosrc0:src" (property-notify): GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-raw\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ format\=\(string\)I420";
/GstPipeline:pipeline0/GstDshowVideoSrc:dshowvideosrc0.GstPad:src: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
Got message #45 from pad "videoconvert0:src" (property-notify): GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-raw\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ format\=\(string\)I420";
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
Got message #46 from pad "queue0:sink" (property-notify): GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-raw\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ format\=\(string\)I420";
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
Got message #47 from pad "videoconvert0:sink" (property-notify): GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-raw\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ format\=\(string\)I420";
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
Got message #48 from pad "queue0:src" (property-notify): GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-raw\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ format\=\(string\)I420";
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
Got message #49 from pad "sink:proxypad0" (property-notify): GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-raw\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ format\=\(string\)I420";
/GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
Got message #50 from pad "autovideosink0-actual-sink-d3d11video:sink" (property-notify): GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-raw\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ format\=\(string\)I420";
/GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstD3D11VideoSink:autovideosink0-actual-sink-d3d11video.GstPad:sink: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
Got message #51 from pad "autovideosink0:sink" (property-notify): GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"video/x-raw\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1\,\ format\=\(string\)I420";
/GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0.GstGhostPad:sink: caps = video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420
Got message #52 from element "pipeline0" (new-clock): GstMessageNewClock, clock=(GstClock)"\(GstSystemClock\)\ GstSystemClock";
New clock: GstSystemClock
Got message #54 from element "queue0" (state-changed): GstMessageStateChanged, old-state=(GstState)paused, new-state=(GstState)playing, pending-state=(GstState)void-pending;
Got message #55 from element "videoconvert0" (state-changed): GstMessageStateChanged, old-state=(GstState)paused, new-state=(GstState)playing, pending-state=(GstState)void-pending;
Got message #56 from element "dshowvideosrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)paused, new-state=(GstState)playing, pending-state=(GstState)void-pending;