Skip to main content
mpv uses Meson as its build system. Autotools and CMake are not supported.

Prerequisites

Install Meson from your distribution’s package manager or via PyPI:
pip install meson
Meson requires Meson >= 1.3.0 and a C11-capable compiler (GCC or Clang).

Essential dependencies

The following libraries must be present before configuring the build:
LibraryPurpose
libavcodec >= 60.31.102Audio/video decoding
libavfilter >= 9.12.100Filter graph
libavformat >= 60.16.100Demuxing / container formats
libavutil >= 58.29.100FFmpeg utility functions
libswresample >= 4.12.100Audio resampling
libswscale >= 7.5.100Video scaling / pixel conversion
libplacebo >= 7.360.1GPU-accelerated video rendering
libass >= 0.12.2Subtitles and OSD rendering
zlibCompression
iconvCharacter set conversion (usually provided by libc)
Optional dependencies:
LibraryEnables
Lua / LuaJITOSC (on-screen controller) and scripting
libjpegJPEG screenshots
uchardetAutomatic subtitle charset detection
libva / nvdecHardware-accelerated decoding (Linux)

Basic build

1

Configure

Run meson setup to create a build directory and configure the project:
meson setup build
Meson detects available libraries automatically. Review detected features in the output.
2

Compile

meson compile -C build
3

Install

meson install -C build
The default install prefix is /usr/local. Override with --prefix:
meson setup --prefix=/usr build
To see all available build options after configuring:
meson configure build
You can also inspect meson_options.txt in the source root directly. Build logs are written to build/meson-logs/.

libplacebo as a subproject

If a sufficiently recent libplacebo is not available on your system, Meson can build it as a statically linked subproject:
mkdir -p subprojects
git clone https://code.videolan.org/videolan/libplacebo.git \
    --depth=1 --recursive subprojects/libplacebo
Run meson setup build afterwards — Meson will detect and build libplacebo automatically.

Notable build options

OptionDefaultEffect
-Dgpl=falsetrueBuild in LGPL mode (disables some GPL-only features)
-Dlibmpv=falsetrueDisable building the shared libmpv library (enabled by default)
-Dcplayer=falsetrueBuild only libmpv, skip the mpv CLI player binary
-Dlua=enabledautoForce-enable Lua scripting (OSC requires this)
-Dlua=disabledautoForce-disable Lua scripting
-Djavascript=enabledautoEnable JavaScript scripting via MuJS
-Dlcms2=enabledautoEnable ICC color management
-Dbuildtype=releasedebugoptimizedOptimized release build
# LGPL-only build (for embedding in proprietary software)
meson setup -Dgpl=false build

# Library only, no CLI player
meson setup -Dcplayer=false build

Platform-specific instructions

Install development packages for the required libraries using your package manager.Debian / Ubuntu:
apt install build-essential meson pkg-config \
    libavcodec-dev libavfilter-dev libavformat-dev \
    libavutil-dev libswresample-dev libswscale-dev \
    libass-dev zlib1g-dev libjpeg-dev
Fedora:
dnf install gcc meson pkg-config \
    ffmpeg-devel libass-devel zlib-devel libjpeg-turbo-devel
Then build:
meson setup build
meson compile -C build
For X11 output support, also install:
# Debian / Ubuntu
apt install libgl-dev libx11-dev libxrandr-dev libxext-dev \
    libxss-dev libxpresent-dev libvdpau-dev

Using mpv-build

mpv-build is a wrapper that compiles FFmpeg and libass from source and then statically links them into mpv. It is useful when you need specific FFmpeg versions or features not packaged by your distribution.
git clone https://github.com/mpv-player/mpv-build.git
cd mpv-build
./rebuild -j4

LGPL mode

By default, mpv is licensed GPLv2+. To build under LGPLv2.1+ (which removes some features and enables use in proprietary software), pass -Dgpl=false:
meson setup -Dgpl=false build
The client API header (include/mpv/client.h) is always ISC licensed, independent of the -Dgpl setting.
Run mpv --version after installation to confirm the build succeeded and check which features were compiled in.

Build docs developers (and LLMs) love