HanumanInstitute.LibMpv 0.10.1

dotnet add package HanumanInstitute.LibMpv --version 0.10.1
                    
NuGet\Install-Package HanumanInstitute.LibMpv -Version 0.10.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HanumanInstitute.LibMpv" Version="0.10.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HanumanInstitute.LibMpv" Version="0.10.1" />
                    
Directory.Packages.props
<PackageReference Include="HanumanInstitute.LibMpv" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HanumanInstitute.LibMpv --version 0.10.1
                    
#r "nuget: HanumanInstitute.LibMpv, 0.10.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HanumanInstitute.LibMpv@0.10.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HanumanInstitute.LibMpv&version=0.10.1
                    
Install as a Cake Addin
#tool nuget:?package=HanumanInstitute.LibMpv&version=0.10.1
                    
Install as a Cake Tool

LibMpv for .NET

Cross-platform MPV video player library for .NET, with an Avalonia 12 implementation supporting Windows, macOS, and Linux.

Overview

LibMpv wraps the MPV media player API in a clean, idiomatic .NET interface. It is structured in three layers:

  • MpvApi — low-level static P/Invoke calls to the native libmpv library
  • MpvContextBase — .NET-friendly wrappers around the raw API
  • MpvContext — fully strongly-typed commands, properties, and options

LibMpv targets netstandard2.0 and can be used independently of any UI framework.

LibMpv.Avalonia

An Avalonia 12 implementation is provided via the LibMpv.Avalonia package. Drop MpvVideoView into your view and bind MpvContext from your ViewModel:

<mpv:MpvVideoView MpvContext="{Binding Mpv}" />

Renderers

Platform Default Renderer Zero-Copy GPU
Windows Native w/ AngleEGL Yes
macOS OpenGL No
Linux OpenGL w/ EGL Yes

Software rendering is also available as a fallback on all platforms.

Requirements

  • .NET 10 or later
  • Avalonia 12
  • libmpv 0.40.0 or greater

Native libmpv binaries for Windows, macOS, linux.

Getting Started

  1. Install the NuGet packages:
dotnet add package LibMpv
dotnet add package LibMpv.Avalonia
  1. Add MpvVideoView to your Avalonia view and bind a MpvContext instance from your ViewModel.

  2. Configure per-OS rendering modes in your AppBuilder:

using System.Runtime.InteropServices;
using Avalonia.Win32;
using Avalonia.X11;

public static AppBuilder BuildAvaloniaApp()
{
    var builder = AppBuilder.Configure<App>().UsePlatformDetect();

    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
        builder.With(new Win32PlatformOptions
        {
            RenderingMode = [Win32RenderingMode.AngleEgl, Win32RenderingMode.Software]
        });
    else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
        builder.With(new AvaloniaNativePlatformOptions
        {
            RenderingMode = [AvaloniaNativeRenderingMode.OpenGl, AvaloniaNativeRenderingMode.Software]
        });
    else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
        builder.With(new X11PlatformOptions
        {
            RenderingMode = [X11RenderingMode.Egl, X11RenderingMode.Glx, X11RenderingMode.Software]
        });

    return builder.LogToTrace();
}

Windows uses ANGLE (OpenGL ES over D3D11) which is required for the libmpv OpenGL render context to share the same GPU pipeline. macOS uses native OpenGL via Metal. Linux prefers EGL for Wayland compatibility, falling back to GLX for X11.

  1. Use MpvContext to control playback:
Mpv.LoadFile("path/to/video.mp4");
Mpv.Play();

Getting the Native libmpv Libraries

LibMpv requires native libmpv 0.40.0 binaries. Note that mpv does not publish official prebuilt packages — the options below are community-maintained builds.

Windows

Download a prebuilt libmpv-2.dll from one of these community build sources:

macOS

Install via Homebrew (requires macOS 11 or later):

brew install mpv

The dylib will be available at /opt/homebrew/lib/libmpv.dylib (Apple Silicon) or /usr/local/lib/libmpv.dylib (Intel).

Linux (Ubuntu/Debian)

The version of libmpv in the standard Ubuntu repositories may be older than 0.40.0. To get 0.40.0, use the unofficial PPA:

sudo add-apt-repository ppa:ubuntuhandbook1/mpv
sudo apt update
sudo apt install libmpv-dev

For other distros, install via your package manager (e.g. dnf install mpv-libs-devel on Fedora) or build from source using mpv-build.

Sample Project

A sample application is included and has been tested on Windows, Linux, and macOS.

License

This project is licensed under the MIT License.

Originally created by Etienne Charland (mysteryx93) and Vadim Beloborodov (homov).

Maintained by Jeff Baxter (warden-vt).

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on HanumanInstitute.LibMpv:

Package Downloads
HanumanInstitute.LibMpv.Avalonia

MPV implementation for Avalonia including OpenGL, Native and Software renderers

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.10.1 248 5/29/2026
0.10.0 131 5/28/2026
0.10.0-rc.6 72 5/27/2026
0.10.0-rc.5 71 5/25/2026
0.10.0-rc.2 69 5/25/2026
0.10.0-rc.1 68 5/23/2026
0.9.1 3,502 6/26/2023
0.9.0 301 6/26/2023