This Unity plugin allows you to use a LibVLC-powered video player in your Unity-based macOS apps and games. Whether you need to support a rare video format, live streaming, HLS, RTSP or play a 4K video in your latest production, we got you covered. Feel free to give it a try!
Given that this plugin is using LibVLCSharp (which uses LibVLC), it exposes more or less the same feature set and same codecs support than VLC, such as:
And more!
Hardware acceleration is often a highly requested features for video players. Decoding videos with the GPU allows much more efficient decoding allowing to playback high res samples that the CPU could not, while saving battery life and CPU cycles for other apps.
On macOS, GPU hardware video decoder access is performed through either OpenGL or Metal.
At the time of writing, LibVLC does not yet offer a fully featured and battle-tested Metal-based video output for Apple Platform, only OpenGL is available.
So how to do? 🤔
Well, a nice workaround was implemented by Alexandre Janniaux to be able to perform OpenGL calls within a Metal context, notably using CVMetalTextureCacheCreateTextureFromImage.
This way both LibVLC and Unity constraints are satisfied, and both iOS and macOS on Unity use the same Unity Metal backend.
As of today, the initial VLC for Unity macOS release includes both Intel x64 and Apple Silicon ARM64 binaries.
It is possible to build through XCode by generating an XCode project file, or directly generating the final app binary through the Unity Editor. Running VLC Unity in the Unity Editor is also supported, although it can sometimes take a while to load all the libraries. We will be working on speeding that up next.
✨ This is the second Apple platform supported by VLC Unity, after the iOS release last month. Future possible Apple target platforms, depending on your interest, could be tvOS and visionOS! Do reach out if you are interested in any platform not yet supported.
Feel free to let me know what you think on Twitter.
]]>This Unity plugin allows you to use a LibVLC-powered video player in your Unity-based iOS apps and games. Whether you need to support a rare video format, live streaming, HLS, RTSP or play a 4K video in your latest production, we got you covered. Feel free to give it a try!
Given that this plugin is using LibVLCSharp (which uses LibVLC), it exposes more or less the same feature set and same codecs support than VLC, such as:
And more!
Hardware acceleration is often a highly requested features for video players, especially on mobile devices. Decoding videos with the GPU allows much more efficient decoding allowing to playback high res samples that the CPU could not, while saving battery life and CPU cycles for other apps.
On iOS, GPU hardware video decoder access is performed through either OpenGL ES or Metal. While according to Apple, OpenGL ES is officially deprecated on iOS, it is still working, the App Store still accepts submissions of apps that rely OpenGL ES and in fact, many games, browsers and video players (amongst others) still make use of OpenGL ES for various reasons.
However, Unity removed the option to pick OpenGL ES as a graphics API backend when building iOS apps using Unity. Metal is the default and only option.
At the time of writing, LibVLC does not yet offer a fully featured and battle-tested Metal-based video output for Apple Platform, only OpenGL is available.
So how to do? 🤔
Well, a nice workaround was implemented by Alexandre Janniaux to be able to perform OpenGL ES calls within a Metal context, notably using CVMetalTextureCacheCreateTextureFromImage.
This way both LibVLC and Unity constraints are satisfied, and the bridge between both ecosystems on iOS is complete! 🙌
As of today, the initial VLC for Unity iOS release includes ARM64 binaries only. The simulator support will come in a later release.
However, as you might know already, iOS apps can be ran on modern Apple Silicon Macs which can speed up the development experience. Deploying to an iPhone device can be time consuming and a hassle.
We also included initial support for the macOS platform in the VLC Unity asset. This allows you to test VLC features and develop your app using the macOS Editor (or XCode builds) for faster iteration.
✨ This is the first Apple platform supported by VLC Unity. A future macOS release will come soon, tvOS could be an option as well. Do reach out if you are interested in any platform not yet supported.
Feel free to let me know what you think on Twitter.
]]>For the readers unaware, we started distributing binaries on the Unity Store for the open-source VLC for Unity integration back in December 2019.
The integration essentially was a bridge between the Unity game engine and the VLC multimedia engine, allowing to build your own media-player based on VLC technology in Unity-based games. Both Unity, through Mono, and LibVLC are highly portable so this is a compelling argument for this cross-platform integration.
Since the start, we have had many users downloading the assets from the Unity Store for their Unity apps and games when requiring demanding multimedia solutions. We had 3 assets targeting specific platforms:
This all changed at the end of the summer 2023 when Unity emailed us the following:
And just like this, our publisher account was instantly banned.
After months of slow back-and-forth over email trying to find a compromise, including offering to exclude LGPL code from the assets, Unity basically told us we were not welcome back to their Store, ever. Even if we were to remove all LGPL code from the Unity package.
Where it gets fun is that there are currently hundreds if not thousands of Unity assets that include LGPL dependencies (such as FFmpeg) in the Store right now. Enforcement is seemingly totally random, unless you get reported by someone, apparently.
It gets better… Unity itself, both the Editor and the runtime (which means your shipped game) is already using LGPL dependencies! Unity is built on libraries such as Lame, libiconv, libwebsockets and websockify.js (at least). Full list of open-source Unity dependencies here.
So Unity gets to use and benefit from LGPL open-source libraries, games built with Unity depend on LGPL code by default (hello glibc!), but publishers and Unity users are not allowed to do so through the Unity Store?
If you are a company requiring multimedia products or consulting for your own projects, this store will be of interest to you.
After our assets got removed, previous and new customers started emailing us about the status of VLC for Unity. Are we going to keep maintaining the assets? How to get build updates? etc.
Numerous companies make use of the LibVLC SDK and other related technologies (like FFmpeg).
For this reason, we decided to publish a simple Store on the Videolabs website.
This way, existing and new customers can still purchase the binaries for the open-source VLC Unity plugin without our presence on the Unity Store.
Sometimes users will run into issues or request a new feature and while the community can sometimes help, the limited time of a few volunteers only goes so far. I have written about OSS sustainability before and that is very much on topic here.
It is in the best interest of both open-source project maintainers and commercial consumers to have a clear products and services offering for a given project, and that is what we have created with the Videolabs Store for both LibVLC and FFmpeg.
The Videolabs team is composed of VLC and FFmpeg experts in most protocols, formats and platforms.
If you are using or planning to use LibVLC or FFmpeg in your project and need help, whether it be custom builds, bug fixes, SDK integration or simply answers to your questions for your specific needs, these packages are for you!
We have created 3 multimedia consulting packages: 3 hours, 10 hours and 24 hours. They can be purchased for a one-time service or a monthly subscription.
No matter which OS platform or toolkit you are building with, we can help.
The LibVLCSharp commercial license and the LibVLC ebook can also be found in the Videolabs Store, as well as other upcoming products such as Kyber, our new ultra low latency game/desktop streaming and remote control SDK, and more game engine integration such as Unreal.
]]>
As we reach this new arbitrary milestone, I’d like to reflect on the current LibVLC ecosystem developments and what is coming next for our users.
We are working hard towards the support of LibVLC 4 in LibVLCSharp. This includes surfacing new native APIs and modifying existing ones, while keeping in mind ease of use and .NET conventions for a seamless developer experience across all supported platforms.
We also work closely with core VLC developers to provide feedback and help shape the upcoming LibVLC APIs that will enable new capabilities for your applications. A couple of examples of new exciting LibVLC 4 APIs (already/eventually available in all programming languages through LibVLC bindings) include:
/**
* Start/stop recording
*
* \note The user should listen to the libvlc_MediaPlayerRecordChanged event,
* to monitor the recording state.
*
* \version LibVLC 4.0.0 and later.
*
* \param p_mi media player
* \param enable true to start recording, false to stop
* \param dir_path path of the recording directory or NULL (use default path),
* has only an effect when first enabling recording.
*/
LIBVLC_API void libvlc_media_player_record( libvlc_media_player_t *p_mi,
bool enable, const char *dir_path);
This rather complex LibVLC API allows consumers to handle the hardware accelerated rendering themselves, instead of pointing LibVLC to a Window handle. Performant game engine integration, such as Unity3D and Unreal, is one of the key use cases of this new LibVLC 4.0 API.
/**
* Set callbacks and data to render decoded video to a custom texture
*
* \warning VLC will perform video rendering in its own thread and at its own rate,
* You need to provide your own synchronisation mechanism.
*
* \param mp the media player
* \param engine the GPU engine to use
* \param setup_cb callback called to initialize user data
* \param cleanup_cb callback called to clean up user data
* \param resize_cb callback to set the resize callback
* \param update_output_cb callback to get the rendering format of the host (cannot be NULL)
* \param swap_cb callback called after rendering a video frame (cannot be NULL)
* \param makeCurrent_cb callback called to enter/leave the rendering context (cannot be NULL)
* \param getProcAddress_cb opengl function loading callback (cannot be NULL for \ref libvlc_video_engine_opengl and for \ref libvlc_video_engine_gles2)
* \param metadata_cb callback to provide frame metadata (D3D11 only)
* \param select_plane_cb callback to select different D3D11 rendering targets
* \param opaque private pointer passed to callbacks
*
* \note the \p setup_cb and \p cleanup_cb may be called more than once per
* playback.
*
* \retval true engine selected and callbacks set
* \retval false engine type unknown, callbacks not set
* \version LibVLC 4.0.0 or later
*/
LIBVLC_API
bool libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
libvlc_video_engine_t engine,
libvlc_video_output_setup_cb setup_cb,
libvlc_video_output_cleanup_cb cleanup_cb,
libvlc_video_output_set_window_cb window_cb,
libvlc_video_update_output_cb update_output_cb,
libvlc_video_swap_cb swap_cb,
libvlc_video_makeCurrent_cb makeCurrent_cb,
libvlc_video_getProcAddress_cb getProcAddress_cb,
libvlc_video_frameMetadata_cb metadata_cb,
libvlc_video_output_select_plane_cb select_plane_cb,
void* opaque );
The version 4 of LibVLC is still in development, so the API is not frozen yet, but the core functionality is already quite stable and used by many clients on all platforms, as well as the Unity integrations.
We recently shipped support for the UWP platform in VLC Unity, enabling the use of LibVLCSharp and LibVLC in Microsoft HoloLens devices, desktop and Xbox platforms, in addition to the existing Android and Windows classic targets.
As we are finalizing support for VLC Unity on iOS and macOS, we will then focus on general developer experience improvements as well as documentation efforts to solidify the Unity integration.
The feedback we have received so far is great: the video decoding performance is unmatched and VLC Unity is one of the most capable and advanced media player asset currently available on the Videolabs Store in terms of features.
While we initially released a LibVLCSharp / Uno integration back in 2019, it has not been updated for a while to keep up with the latest Uno releases and accompanying API changes.
This may all change soon, now that Uno decided to use LibVLC for their Linux mediaplayer support.
We are looking forward to work together to improve the developer experience for .NET developers in the multimedia space across all platforms that Uno and VLC support.
Exactly 2 years ago, we introduced the LibVLCSharp Commercial License in an effort to secure the long term maintenance of the project. I firmly believe companies should be put to contribution when it comes to opensource sustainability, not individuals, and I have written about this topic before.
If your company relies on LibVLCSharp for their commercial products, we encourage you to support the project and help secure the long term maintenance by purchasing a commercial license today.
For more general multimedia needs, such as consulting, training, specific LibVLC / FFMPEG features or bug fixes, or even new platforms support, Videolabs is the partner of choice with experts on all platforms.
Almost 3 years ago, we created the LibVLC Discord Server to foster the LibVLC community with both LibVLC users and bindings maintainers, for all 12 supported programming languages.
The Discord server has grown steadily to 1200+ members and it is a place where LibVLC users can get support from other members of the LibVLC community. Bindings maintainers also help each others out at times.
When someone has a cool use case or sample they want to share with the community, they can post in the showcase channel on the LibVLC Discord. For example, that is how I learned about the existence of the VLC support in Minecraft, using the awesome VLCJ bindings from Caprica.
The latest cool kid on the block, ziglang, made an appearance in the VLC community with libvlc-zig which allows Zig developers to enjoy a compelling developer experience while using LibVLC and Zig. We are looking forward to see the apps you build with Zig and LibVLC!
While libvlc-zig focuses on the LibVLC API, it is also possible to use Zig to build native VLC plugins using the lower level VLC API, such as this vlc-mixer example.
Stay tuned.
]]>This Unity plugin allows you to use a LibVLC-powered video player in your Unity-based UWP apps and games. Whether you need to support a rare video format, live streaming, HLS, RTSP or play a 4K video in your latest production, we got you covered. Feel free to give it a try!
Given that this plugin is using LibVLCSharp (which uses LibVLC), it exposes more or less the same feature set and same codecs support than VLC, such as:
And more!
The 4.0 development version of LibVLC provides a powerful API which allows to perform custom rendering yet retaining hardware accelerated decoding.
In the context of Unity, this means using VLC for Unity allows you to use video frames as GPU textures in your Unity games. For UWP, this solution is based on Direct3D11.
This is as simple to use for you as writing
MediaPlayer.GetTexture(out texture);
and uploading it to Unity for post-processing in your game scene.
The CPU architectures supported on UWP by VLC Unity are as follows:
Xbox and Hololens devices, in addition to regular Windows 10/11 desktop devices are therefore supported. This is the 3rd platform supported by VLC for Unity, in addition to Windows Classic and Android.
Feel free to let me know what you think on Twitter.
LibVLCSharp has had support for the Universal Windows Platform (UWP) since the early days. Before LibVLCSharp, the work to integrate LibVLC with the UWP platform and make the LibVLC engine work well on it, was pioneered by the now defunct VLC for WinRT project.
WinUI is the next evolution of the modern UI toolkit for the Windows desktop after UWP (unfortunately, the Xbox target is not supported with WinUI).
As of LibVLCSharp version 3.7.0, building multimedia apps using WinUI 3 is now supported with LibVLC. Expect the usual goodies such as default hardware decoding enabled.
Both Packaged and Unpackaged WinUI apps are supported with LibVLCSharp.
There are several important caveats and changes from the previous UWP LibVLCSharp support that I will detail below, for users migrating or supporting both UWP and WinUI.
When upgrading to LibVLCSharp version 3.7.0, users currently targeting UWP will need to address a build failure as there was a needed namespace change.
In your XAML files:
-xmlns:lvs="using:LibVLCSharp.Platforms.UWP"
+xmlns:lvs="using:LibVLCSharp.Platforms.Windows"
In your C# files:
-using LibVLCSharp.Platforms.UWP;
+using LibVLCSharp.Platforms.Windows;
This should be quick and as painless as possible to fix as you upgrade to LibVLCSharp 3.7.0 in your UWP applications. The minor version of LibVLCSharp is bumped according to our documented versioning strategy.
With UWP apps using LibVLCSharp, the user needs to add a special, custom-built LibVLC variant, the VideoLAN.LibVLC.UWP nuget package. This has always been the case and is due to the expectation of the underlying runtime of the UWP platform.
For WinUI targets, the classic Windows LibVLC build, VideoLAN.LibVLC.Windows, must be used and only from version 3.0.18 minimum. Using a UWP LibVLC build will not work. As always, starting from the official sample app is a good idea.
The minimal WinUI TFM supported version is net6.0-windows10.0.17763.0
. Do make sure you target it for your WinUI project (or anything above).
As we release this initial support of WinUI on NuGet, please make sure to tell us if you encounter any issue and what apps you build with LibVLCSharp for WinUI!
]]>This book is the first book ever about LibVLC and the VideoLAN community.
VLC reached 3 billion downloads in 2019. While there is a lot of information out there on VLC and VideoLAN, it is quite spread out across various sources. With all the podcasts, press releases, wikis, forum posts, git repositories and blog posts from community members, I felt that a longer form of content, such as this book, would be welcome to synthesize all this information into one place and provide context around the amazing VLC community.
Although the VLC app is well known and popular, the accompanying library SDK for developers, LibVLC, remains largely unknown to many developers. This technical book serves as a way to raise awareness of this great multimedia framework as a viable option for developers, as well as a detailed example of what an ethical opensource project looks like.
Since I personally built and used the LibVLC library on most platforms during the past 5+ years, and helped polish the developer experience of the library on all platforms through LibVLCSharp, I managed to get a pretty nice overview of the LibVLC landscape.
I have put everything I know about LibVLC, VLC and VideoLAN in this book.
We will dive into the internals of the native library in Part 2, and the focus will shift to the LibVLC usage, its public API interfaces, features and capabilities (in Parts 3 and 4) through LibVLCSharp (.NET bindings for LibVLC).
By the end of this book, you will know everything you need to build your own video/audio player app using LibVLC, for any target platform using any programming language.
All kinds. Beginner to senior, all programming languages.
Everyone will learn something. I have tried to keep things approachable while not shying away from the deeply technical topics that needed to be covered. This was sometimes a tricky balancing act. Most of the code in the book is C# with a bit of C, though the code snippets are succinct and fairly intuitive to read, no matter which programming language you fancy (LibVLC works with most of them).
You do not need to be knowledgeable in .NET/C# to read and understand the code in this book.
Yes. Most important multimedia concepts are explained from scratch when going through the LibVLC internals, so multimedia novices will be able to follow. As for the API usage sections, the ease of use of LibVLC being one of its assets, this should be an approachable read for beginners in the multimedia programming space.
Happy reading!
]]>
Seasoned Unity developers will recognize the famous Courtyard Unity scene which was edited to showcase our VLC plugin playing the famous Big Buck Bunny video.
This Unity plugin allows you to use a LibVLC-powered video player in your Unity-based Android apps and games. Whether you need to support a rare video format, live streaming, HLS, RTSP or play a 4K video in your latest production, we got you covered. Feel free to give it a try!
Given that this plugin is using LibVLCSharp (which uses LibVLC), it exposes more or less the same feature set and same codecs support than VLC, such as:
And more!
The 4.0 development version of LibVLC provides a powerful API which allows to perform custom rendering yet retaining hardware accelerated decoding.
In the context of Unity, this means using VLC for Unity allows you to use video frames as GPU textures in your Unity games. For Android, this solution is based on OpenGL ES.
This is as simple to use for you as writing
MediaPlayer.GetTexture(out texture);
and uploading it to Unity for post-processing in your game scene.
The CPU architectures supported on Android by VLC Unity are as follows:
We have recently added several new Unity scenes into the VLC asset. These are shipped with the VLC Unity asset from the Videolabs Store. They provide an efficient way to get started quickly and showcase real use case scenarios for your apps and games.
This is a basic cinema room with a bit of light, a cinema screen powered by VLC and comfortable chairs.
This screenshot shows an in-Editor run of the VLC Canvas example, essentially a simple MediaElement control with a seekbar and a few playback options. It’s great because it shows you how to use the LibVLCSharp APIs and bind them with Unity materials and scripts!
We will add more features to this scene in the future. And more scenes.
The next major platform we will work on supporting is iOS. It is already supported by both LibVLCSharp and LibVLC, but the VLC Unity plugin needs some adjustments to support iOS. Feel free to reach out if you are interesting in testing this out!
Other than iOS, we will keep on improving the plugin, continuously fixing bugs and enhancing the developer experience. Deeper Unity Editor integration with LibVLC is planned as well, so that in the future you may customize various playback parameters right from the Unity Editor menus!
Feel free to let me know what you think on Twitter.
Today, we actively publish and maintain 16 NuGet packages, 6 of which actually containing native platform-specific code. The remaining 10 packages are managed C# DLLs composed of the main binding (LibVLCSharp) and various GUI toolkit integrations for getting users up and running quickly.
Both LibVLCSharp and LibVLC for NuGet received PRs from a few new contributors recently. They helped out on adding support for new GUI frameworks like Eto, perfecting the WPF VideoView integration and making sure the LibVLC native library plays nice with the latest .NET SDK! I’d like to thank each of them for their valuable OSS contributions.
LibVLC 4 is actively being worked on by the core VLC team and we can expect several new LibVLC APIs to surface in LibVLCSharp in the coming months. I am keeping a personal wishlist for LibVLC features on my side and I try to work on it when time allows. If you would like to see a specific LibVLC feature come to life, feel free to reach out!
Plans to investigate LibVLCSharp interop performance further have been made and it will be exciting to leverage new interop performance features from .NET 5/6 with LibVLC.
Almost a year ago, we introduced Commercial Licenses for LibVLCSharp through dual licensing (current OSS licenses remain). This was the start of an experiment to try and make the project financially sustainable. I don’t believe user donations are a working solution for most OSS maintainers, and if companies contributed financially to the sustainability of their dependencies, I believe the open-source ecosystem would be more balanced.
After a needed pricing change, and almost a year in, we now stand at $224 monthly recurring revenue with 11 happy customers and growing! This is certainly better than the donation route but there surely is a way to go still.
If your company uses LibVLCSharp in commercial products, please consider supporting the project by purchasing a commercial license!
Feel free to let me know what you think on Twitter.
]]>I have written before on the topic of open-source sustainability. This is a subject I find personally very interesting and solutions to these problems can prove tricky.
Donations just do not work.
And for developer tools, another approach seems particularly fitting: Dual licensing.
LibVLCSharp packages (and LibVLC) will remain licensed under the LGPL2.1 license. However, an additional Commercial License is now available for commercial .NET users.
This is very much like the approach our friends at Six Labors, makers of ImageSharp1, have chosen, and I believe it strikes a good balance between keeping an open and accessible license for individual developers, and inviting companies who critically rely on open-source projects to contribute financially.
Our initial pricing is a single plan set at 99$/year per developer2 (including VAT).
We may introduce additional plans in the future, depending on your feedback. This is very competitive pricing considering the years of work that have already been put in LibVLCSharp (not to mention LibVLC), and the additional guarantees you will get for that small price:
If your company builds commercial products using LibVLCSharp, we strongly encourage you to purchase one (or several) LibVLCSharp Commercial Licenses. Doing so will help support the project’s long term viability.
1 Btw, we have a nice and short LibVLCSharp/ImageSharp code sample!
2 If you require special pricing plans, such as Enterprise or Non-Profit, feel free to contact us.
]]>