Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

VLC for Unity (Windows) - Official plugin by VLC developers

Discussion in 'Assets and Asset Store' started by Videolabs, Dec 18, 2019.

  1. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    Hello,

    Today we released the first version of VLC for Unity (Windows, for now) and wanted to share that good news here with you.

    I made a blog post explaining how we got there, what is the focus of the plugin (performance and all VLC features!) and the roadmap for what's next in 2020. This plugin is using the official VideoLAN C# bindings for libvlc, LibVLCSharp https://code.videolan.org/videolan/LibVLCSharp

    Asset link: https://assetstore.unity.com/packages/tools/video/vlc-for-unity-windows-133979
    Blogpost: https://mfkl.github.io/libvlc/unity/2019/12/18/Introducing-LibVLCSharp-for-Unity.html

    Feedback welcome! Happy coding :)
     
  2. unity_intopalo

    unity_intopalo

    Joined:
    Jun 13, 2017
    Posts:
    2
    Hi. Looks interesting. How is the Linux support coming along?
     
  3. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    Hi there!

    Thanks for your interest.

    LibVLCSharp (without Unity) works on Linux so that part is done.
    The OpenGL Unity part has been made to work on Windows before, so it needs to be updated and adjusted for Linux, but shouldn't be too much work.

    However the Unity Editor on Linux has been unusable last we tried, crashing on startup. And the focus lately has been on stabilizing the Windows support and getting the Android plugin out of the door (one last blocker).
     
    unity_intopalo likes this.
  4. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
  5. miguellamas_talento

    miguellamas_talento

    Joined:
    Mar 20, 2019
    Posts:
    1
    Hello, i want to stream a 360 video into Unity and use it as an skybox with the panoramic shader for VR content. Is this posible with VLC?
     
  6. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    360 video are supported, including viewpoint navigation, but I have not tested the panoramic shader.
     
  7. virtualjay

    virtualjay

    Joined:
    Aug 4, 2020
    Posts:
    68
    I just tried this today. As near as I can tell, there is still no Android support. Am I wrong in this? I figured five months later it must be working since there was "one last blocker."
     
  8. dallasdim

    dallasdim

    Joined:
    Jun 18, 2019
    Posts:
    3
    Hi @Videolabs ,

    I want to stream a 360 camera to custom RTMP server.
    I have tried your Demo version and it can normally catch RTMP stream from a normal GoProHero8.
    Can VLC Player for Unity (windows) catch the RTMP stream of the 360 camera and display it in a texture?
    I only ask you because I don't currently have the 360 camera to test it myself.

    Thank you in advance,
    Dimitris
     
  9. noemiepollien

    noemiepollien

    Joined:
    Jan 7, 2021
    Posts:
    2
    Hi @Videolabs,

    We use this Asset to stream a 360° video. We use the demo mode (ThreeeSixty) from this asset and we modified the script to ad the tunnel to stream (we changed the URL) in Unity but ideally we wish to stream with RTSP, but it doesn't work (we can't see the video). We use the free version of this asset. Our question is : if we buy the paid version , is the RTSP can work (we don't have any errors message in the Log) or it has nothing to do with ?
     
  10. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    Nothing to do with. You should share some logs.
     
  11. luizleo

    luizleo

    Joined:
    Jan 24, 2018
    Posts:
    4
    Hi @Videolabs

    My team is very interested in buying the plug-in, but we are experiencing a lot of crashes when using the trial version, is there any chance of improving with the full version?

    I'm using RTSP to stream from a camera on the network, I had to reduce the quality of the camera to avoid crashes, but still, just move the mouse over the canvas buttons that Unity simply freezes.

    I am also trying to switch between two cameras, but the program crashes when performing an operation, although it works sometimes, I tried to approach the problem in two ways:

    First: Going to _mediaPlayer, and starting it again with the link for the new camera.

    Second: Creating two _mediaPlayers and alternating between them with Stop () on one and Play () on the other, in both forms the program crashes.

    Any solutions to these problems? In log, nothing useful appears.
     
  12. luizleo

    luizleo

    Joined:
    Jan 24, 2018
    Posts:
    4
    Att,

    I found that when giving PlayPause () using the MinimalPlayback routine Unity crashes when pausing and playing again.
     
  13. luizleo

    luizleo

    Joined:
    Jan 24, 2018
    Posts:
    4
    Update: after doing a clean and making the program lighter the crashes stopped happening, although it was necessary to decrease the camera resolution from FHD to HD!
     
  14. noemiepollien

    noemiepollien

    Joined:
    Jan 7, 2021
    Posts:
    2
    There is some screen shots and log from my code and Unity Interface

    upload_2021-2-1_17-3-4.png
    upload_2021-2-1_17-3-19.png
     

    Attached Files:

    Last edited: Feb 3, 2021
  15. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    92
    Hi. Sample code makes my video frame render mirrored. How would I remedy that?

     
  16. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    This is a known issue on Unity. Apply a transform with m_LocalScale: {x: -1, y: 1, z: 1} to reverse the texture.
     
  17. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    92
    thanks! However, my goal is to render this to a render texture which is then used in a decal projector. Not sure I can use the same workaround then?
     
  18. APSchmidtOfOld

    APSchmidtOfOld

    Joined:
    Aug 8, 2016
    Posts:
    4,473
    My apologies but what about trying? :)
     
  19. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    92
    Haha, good point! Away from computer for a few days hence the stupid suggestion. I will try
     
  20. APSchmidtOfOld

    APSchmidtOfOld

    Joined:
    Aug 8, 2016
    Posts:
    4,473
    Ah, okay. I think you have to use the "fix" (which is not a fix since the sprite are always like on the image you posted and you have to reverse the texture anyway). Using it on the render texture should do the trick. :)
     
  21. Demis

    Demis

    Joined:
    Jul 15, 2014
    Posts:
    1
    Hi @Videolabs,

    I'm exploring your Unity plugin through the free trial version. Currently I'm able to stream a local video file from within a Unity scene (acting like a server); but it's not clear to me if it is possible, in my Unity scene, e.g. to project a video on a plane, frame it with a camera, and stream it using a Render Texture as a source for a MediaPlayer object. If this is not possible, there is some workaround I can put in place for this scenario?

    Thanks.
     
  22. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    Hi @Demis, I'm not sure I understand correctly, but feel free to open an issue on our gitlab to ask more details.
    The media can be a URI, a file descriptor, or a .NET stream or byte array. Hope that helps.
     
  23. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
  24. jlx_ifqq

    jlx_ifqq

    Joined:
    Dec 15, 2021
    Posts:
    1
    How to install or download libvlc (4.x.x version) on Linux?
     
  25. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    Linux is not currently one of the supported platforms by VLC for Unity. It will likely land in the future though. You can either build libvlc 4 yourself or check with your package manager if they provide nightly builds.
     
  26. Sky-Fox

    Sky-Fox

    Joined:
    Nov 10, 2012
    Posts:
    5
    Bought the android version.
    The version does not work in the Editor.
    On Android, the rtsp protocol does not work.
    How to fix these errors, or How to return Money for a non-working plugin?
     
  27. Sky-Fox

    Sky-Fox

    Joined:
    Nov 10, 2012
    Posts:
    5
  28. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    This initial version is targeting Android, so that is what we included. We learned afterwards that Unity users expect the functionality to work also in the Editor, which means shipping a Windows version of the plugin as well, in the Android plugin. We will do so in the next release.

    RTSP should work fine, according to our tests. Our gitlab is the main place for bug reports and feature requests https://code.videolan.org/videolan/vlc-unity. If you have more questions, email us at unity@videolabs.io
     
  29. Jonnyrg_16

    Jonnyrg_16

    Joined:
    Feb 1, 2018
    Posts:
    2
    This plugins works in VR Apps Deployed to Oculus Quest, Beause in Editor works but in build not working?
     
  30. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    The Windows version of the plugin will work on Windows (which the Editor runs in) and the Android version will run on Oculus.
     
  31. Marwan_Ayyad

    Marwan_Ayyad

    Joined:
    Apr 1, 2014
    Posts:
    12
    unfortunately, the android version doesn't work ( Trail version ), i followed your guidelines, but whenever i deploy on android, it seems it can't find 'libVLCUnityPlugin' and 'libvlc'
     
  32. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    Hi, it's been working fine here. Are you sure the inspector is properly configured to deploy these binaries? The trial version only has the armv7 version.
     
  33. Marwan_Ayyad

    Marwan_Ayyad

    Joined:
    Apr 1, 2014
    Posts:
    12
    so i think the issue is there no dll for arm64 , am i right ?
    i was hoping to test the plugin before buying it on my oculus quest 2
     
  34. Egz

    Egz

    Joined:
    Oct 17, 2013
    Posts:
    7
    Has someone been able to create a solution to this? I want to take a Unity camera, and stream it as a RTSP video to another system. We've done this before with home baked code as a video JPG, but the target platform is expecting RTSP, so I was hoping that VLC could do that for us.
     
  35. heckman13

    heckman13

    Joined:
    Feb 20, 2017
    Posts:
    2

    Attached Files:

  36. heckman13

    heckman13

    Joined:
    Feb 20, 2017
    Posts:
    2
    PROBLEM SOLVED! I just wanted to say, that unchecking the following boxes from the VLC Player Example (Canvas) Script solved the issue. Just posting this for anyone else who might be having this problem. (See attached picture)
     

    Attached Files:

  37. Lumen-Digital

    Lumen-Digital

    Joined:
    Aug 3, 2012
    Posts:
    16
    Hi All

    I want to playback a file over the network and save it on the local machine. This is possible using the following code:

    string directory = Application.dataPath;
    string file = Path.Combine(directory, "record.ts");
    Uri uri= new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4");
    media = new Media(uri);
    media.AddOptionFlag(":sout=#file{dst=" + file + "}", 0);
    media.AddOptionFlag(":sout-keep", 1);

    Unfortunately, saving the stream causes the texture not to update.
    Has anyone resolved this issue using fags?
     
  38. Lumen-Digital

    Lumen-Digital

    Joined:
    Aug 3, 2012
    Posts:
    16
    Hi,

    I am having trouble applying filters to individual Media Players. I can active a filter when instigating libVlc but can't adjust the settings using set option in the media object.

    Has anyone successfully applied filters?
     
  39. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    I think VLC for Unity is GPL infected.
    Example: liba52 ("Assets\VLCUnity\Plugins\Windows\x86_64\plugins\codec\liba52_plugin.dll")

    The VLC nightly includes a THANKS.txt file, which names used libs and their license. And there are more libs under GPL that are included in the VLC for Unity Plugin.

    VLC itself is also GPL so it's not an issue for the project.

    But it's an issue for the Unity package.
    Most people who buy it on the Asset Store have closed source projects and do not want to comply with GPL requirements.
    Further, Unity does not allow GPL stuff on the Asset Store (actually not even LGPL stuff). See https://unity.com/legal/provider (section 5.10.4)

    So, please VLC team, create a package of libVLC and libVLCSharp for Unity without GPL stuff.
     
  40. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    Hi @achimmihca,

    Thank you for your message!

    Indeed, we have identified this problem a few weeks ago and this has already been corrected in the source https://code.videolan.org/videolan/vlc/-/merge_requests/3834.

    We will push an update shortly to the Windows plugin to correct this and make it fully LGPL compliant. In the meantime, as a workaround, we encourage you to remove the liba52 dll from your project.

    Thanks for your concern.
     
    achimmihca likes this.
  41. jeffdyerSRTMarine

    jeffdyerSRTMarine

    Joined:
    Jan 23, 2019
    Posts:
    12
    Hi having issues with Unity engine 2022.3.5f1, on certain (not all user PCs) application fails to load, just crashes at startup.

    Last lint in player.log is this ..
    07/08/2023 14:40:34 TrackManager.LoadConfig() - Manager type Realtime - WEBSOCKET_TARGETS_PER_FRAME set to 300.

    On machines where it does load we get these entries - I can only find any reference to this using a dependency walker, any ideas? Are these references part of VLCUnity?

    07/08/2023 13:39:32 TrackManager.LoadConfig() - Manager type Realtime - WEBSOCKET_TARGETS_PER_FRAME set to 300.
    Fallback handler could not load library D:/geovs-chart-r13/Build/GeoVS_Data/Mono/libX11
    Fallback handler could not load library D:/geovs-chart-r13/Build/GeoVS_Data/Mono/libX11.dll
    Fallback handler could not load library D:/geovs-chart-r13/Build/GeoVS_Data/Mono/libX11
    Fallback handler could not load library D:/geovs-chart-r13/Build/GeoVS_Data/Mono/libSystem
    Fallback handler could not load library D:/geovs-chart-r13/Build/GeoVS_Data/Mono/libSystem.dll
    Fallback handler could not load library D:/geovs-chart-r13/Build/GeoVS_Data/Mono/libSystem
     
  42. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    Hi,

    That's odd.. it doesn't look very specific to VLC Unity. Feel free to open a bug report on our gitlab with a way for us to reproduce and we will have a look!
     
  43. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    Hi,

    I bought VLC for Unity (Windows) and have some issues.
    My use case is to have separate video and audio. The video is synced with the audio.

    - Mute and SetVolume(0) on a MediaPlayer does not work well. At least, I can not mute only MediaPlayer this way. It is either all (the whole app, including Unity Editor and Unity API) or nothing.
    - Workaround: to mute a MediaPlayer, SetAudioCallbacks with empty callbacks worked for me

    - MediaPlayer.Time is increased even when the MediaPlayer is paused
    - MediaPlayer.Time is not strictly increasing. There are some frames where the position jumps from a higher value to a lower value. Example: frame N has MediaPlayer.Time 100ms, whereas frame N+1 has MediaPlayer.Time 90ms although still playing.

    - I did not find a good way to set the playback speed. I want to synchronize the separate MediaPlayer instances by setting the playback speed of the video. With Unity API, this works smoothly. But MediaPlayer.SetRate says "it might not actually work depending on the underlying media protocol". Is there a better way to set the playback speed of the video or to synchronize two MediaPlayer instances?
    - MediaPlayer.SetRate seems to work for mp4, but I found that the video stutters when I change the value for example every second (to synchronize smoothly with the audio)

    Would be great if these issues could be fixed.
    Otherwise, the plugin works stable and with good performance for me.
     
    Last edited: Aug 14, 2023
  44. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    Hi @achimmihca,

    For these issues, I encourage you to read our bug reporting guidelines and create issues on https://code.videolan.org/videolan/vlc-unity, using the issue template. One ticket per bug report please, so we can manage this properly. That being said, here are some initial thoughts.

    With any media? That is odd.

    Synchronizing 2 mediaplayer instances is sadly not part of the libvlc feature set. They have their own clocks and changing the playback rate will not achieve this. Also, changing the playback rate every second will have deep impacts on the core library as a bunch of component need to adapt to the new value. It is not expected to change this value every second.

    Hope these insights help.
     
  45. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    Thanks, will open corresponding bug reports.

    Quick question: is there a way to get the audio samples of a file?

    > MediaPlayer.Time is increased even when the MediaPlayer is paused

    Pause does not work properly in general, but only on built app (in Editor it seems to work). IsPlaying is still true and I get app crashes.
     
    Last edited: Aug 16, 2023
  46. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    achimmihca likes this.
  47. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    Hi there,

    As you've probably noticed, Unity removed us from the Unity Store. We will provide an alternative distribution channel for the VLC for Unity asset soon, as well as macOS and iOS versions (in addition to the existing Android, UWP and Windows versions). Stay tuned!
     
  48. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    Was there an official statement why they removed the plugin?
    There are not many alternatives in the Asset Store, so this is a pity.
     
  49. Videolabs

    Videolabs

    Joined:
    Nov 28, 2018
    Posts:
    36
    Someone reported us to Unity for violating the Store rules (using LGPL licensed code in the asset). In addition to it being a very questionable Store rule (LGPL is compatible with closed-source software), there are plenty of other assets bundling FFmpeg hence violating this rule.

    The asset will be available soon through other distribution channels.
     
  50. Nejc090

    Nejc090

    Joined:
    Nov 23, 2022
    Posts:
    2
    Hi,

    is there a way to use the plugin in an older version of unity (2017)?

    Would rewriting the scripts of this plugin for .net 2.0 and doing the same for libvlcsharp do the trick?