Skip to content

Instantly share code, notes, and snippets.

@linguisticmind
Last active November 18, 2025 13:35
Show Gist options
  • Select an option

  • Save linguisticmind/d765a12e121bfdef2e8878b38d11b5ef to your computer and use it in GitHub Desktop.

Select an option

Save linguisticmind/d765a12e121bfdef2e8878b38d11b5ef to your computer and use it in GitHub Desktop.
compile_mpv.md | "Compiling mpv on Debian - latest master version" (https://youtu.be/KdyX3k8vOhw) | Mindful Technology

Compile mpv on Debian

Video tutorial:

Video tutorial

Links

1. Clone mpv-build repo

git clone https://github.com/mpv-player/mpv-build.git
cd mpv-build/

2. Install dependencies

A single command to install everything:

# Note: This command may need adjustment in the future
#       since mpv dependencies and the files provided
#       in the `mpv-build` repository may change.

sudo apt install \
  gcc libgnutls28-dev \
  $(
    sed -En '
      /^Build-Depends/, /^$/ {
        /^ / {
          s/( \| [^,]*| \[[^]]*\]| \([^)]*\))?,$//
          s/^ //
          /^libgnutls-dev$|^c-compiler$/ d
          p
        }
      }
    ' debian/control
  ) \
  libmujs-dev

# At the time of making this tutorial, the Debian Backports
# version of `meson` was also needed:
sudo apt install meson/bookworm-backports

Breakdown of the command above:

# Get the list of dependencies:
sed -En '/^Build-Depends/, /^$/ { /^ / { s/( \| [^,]*| \[[^]]*\]| \([^)]*\))?,$//; s/^ //; /^libgnutls-dev$|^c-compiler$/ d; p } }' debian/control
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# * This command will be referred to as `<get_deps_command>` going forward. *
# * Wherever you see the placeholder `<get_deps_command>`, replace it with  *
# * the actual command.                                                     *
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

# We can check that all the dependency package names
# are correct and available on APT by piping the output
# of `<get_deps_command>` to `apt list`, and also using
# `wc` to check that we get the same number of packages
# from `apt list` as we do from `<get_deps_command>`.
<get_deps_command> | wc -l
<get_deps_command> | xargs apt list 2> /dev/null | sed -E '1 { /^Listing\.\.\.$/ d }' | wc -l

# These are the dependencies that were excluded by `<get_deps_command>`
# because they were named differently in `debian/control`.
# You have to figure out the package names yourself in this situation.
apt list gcc libgnutls28-dev

# Install dependencies by passing our obtained list to `sudo apt install`,
# and manually adding in `gcc` and `libgnutls28-dev`.
sudo apt install gcc libgnutls28-dev $(<get_deps_command>)

# For JavaScript support, you need to install the following package:
sudo apt install libmujs-dev

# At the time of making this tutorial, I also had to install a newer version of `meson` from `bookworm-backports`:
sudo apt install meson/bookworm-backports

3. Compile

./rebuild -j<n> # <n> is a number of parallel processes

The compiled application can be found in mpv-build/mpv/build.

4. Install (optional)

sudo ./install

It does the following:

Installing mpv.1 to /usr/local/share/man/man1
Installing mpv to /usr/local/bin
Installing mpv.desktop to /usr/local/share/applications
Installing /home/user/local/src/mpv-build/mpv/etc/mpv.conf to /usr/local/share/doc/mpv
Installing /home/user/local/src/mpv-build/mpv/etc/input.conf to /usr/local/share/doc/mpv
Installing /home/user/local/src/mpv-build/mpv/etc/mplayer-input.conf to /usr/local/share/doc/mpv
Installing /home/user/local/src/mpv-build/mpv/etc/restore-old-bindings.conf to /usr/local/share/doc/mpv
Installing /home/user/local/src/mpv-build/mpv/etc/restore-osc-bindings.conf to /usr/local/share/doc/mpv
Installing /home/user/local/src/mpv-build/mpv/etc/mpv.bash-completion to /usr/local/share/bash-completion/completions
Installing /home/user/local/src/mpv-build/mpv/etc/_mpv.zsh to /usr/local/share/zsh/site-functions
Installing /home/user/local/src/mpv-build/mpv/etc/mpv.metainfo.xml to /usr/local/share/metainfo
Installing /home/user/local/src/mpv-build/mpv/etc/encoding-profiles.conf to /usr/local/etc/mpv
Installing /home/user/local/src/mpv-build/mpv/etc/mpv-icon-8bit-16x16.png to /usr/local/share/icons/hicolor/16x16/apps
Installing /home/user/local/src/mpv-build/mpv/etc/mpv-icon-8bit-32x32.png to /usr/local/share/icons/hicolor/32x32/apps
Installing /home/user/local/src/mpv-build/mpv/etc/mpv-icon-8bit-64x64.png to /usr/local/share/icons/hicolor/64x64/apps
Installing /home/user/local/src/mpv-build/mpv/etc/mpv-icon-8bit-128x128.png to /usr/local/share/icons/hicolor/128x128/apps
Installing /home/user/local/src/mpv-build/mpv/etc/mpv-gradient.svg to /usr/local/share/icons/hicolor/scalable/apps
Installing /home/user/local/src/mpv-build/mpv/etc/mpv-symbolic.svg to /usr/local/share/icons/hicolor/symbolic/apps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment