Media from capture card in Unity with Vlc plugin for Unity

984 views Asked by At

I am trying to get the camera feed from a blackmagic capture card into the mediaplayer of the Vlc plugin for Unity.

What i have done :

  • I can get the capture device with the vlc desktop application, so camera and capture card work fine.

  • I can run the sample scene of the vlc plugin which show an video from a web url, it works fine

  • I searched the LIBVLCSharp to try to understand a bit how it all works, https://code.videolan.org/videolan/LibVLCSharp/-/blob/master/src/LibVLCSharp/Media.cs
  • I am trying to modify the UseRenderingPlugin.cs, which is a script which plays the video on a texture in the Unity scene, and especially the line which chose the media to be played :

The original line of code : _mediaPlayer.Media = new Media(_libVLC, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", FromType.FromLocation);

And what i achieved so far (but doesn't work). I changed 'FromLocation' to 'FromPath' and replace the URL with the mrl to the capture card with the options, thanks to the vlc desktop application :

_mediaPlayer.Media = new Media(_libVLC, "dshow://  :dshow-vdev=Blackmagic WDM Capture :dshow-adev=Entrée ligne (Blackmagic DeckLink Mini Recorder 4K Audio)  :dshow-aspect-ratio=16\\:9 :dshow-chroma= :dshow-fps=50 :no-dshow-config :no-dshow-tuner :dshow-tuner-channel=0 :dshow-tuner-frequency=0 :dshow-tuner-country=0 :dshow-tuner-standard=0 :dshow-tuner-input=0 :dshow-video-input=-1 :dshow-video-output=-1 :dshow-audio-input=-1 :dshow-audio-output=-1 :dshow-amtuner-mode=1 :dshow-audio-channels=0 :dshow-audio-samplerate=0 :dshow-audio-bitspersample=0 :live-caching=300 ", FromType.FromPath);

I would like to ask you if anyone knows the right syntax to use directshow in that function, or redirect me to a similar topic (that I haven't been able to found though, but i apologize if I missed it) or if I'm getting it all wrong.

Thank you so much for your time, it's the first time I use this plugin and LibVLCSharp so please be patient with me :D

1

There are 1 answers

0
YM_P On BEST ANSWER

Thank you @mfkl for your help.

Here is what has worked :

_mediaPlayer.Media = new Media(_libVLC, "dshow:// ", FromType.FromLocation );

And add all the options like this : _mediaPlayer.Media.AddOption(":dshow-vdev='Blackmagic WDM Capture'"); _mediaPlayer.Media.AddOption(":dshow-fps=50"); ...