Skip to content

m154k1/mpv-build-macOS

Repository files navigation

mpv-build-macOS

A set of scripts that help build mpv with MoltenVK support.

Requirements

Preparation

  1. Make sure Xcode is ready by running:

    xcodebuild -runFirstLaunch
  2. Clone the repository:

    git clone "https://github.com/m154k1/mpv-build-macOS.git"
    cd mpv-build-macOS
  3. Install dependencies from Homebrew:

    xargs brew install --formula < homebrew/build.txt
    xargs brew install --formula < homebrew/runtime.txt
  4. Create an installation directory for local packages:

    sudo mkdir /opt/local
    sudo chown $USER:admin /opt/local
    mkdir /opt/local/stow

    If you want to use a different directory, export $PREFIX environment variable.

Build and install

  1. Vulkan Loader & Vulkan Headers

    git -C src clone "https://github.com/KhronosGroup/Vulkan-Loader.git"
    git -C src clone "https://github.com/KhronosGroup/Vulkan-Headers.git"
    ./build-vulkan
  2. MoltenVK

    git -C src clone "https://github.com/KhronosGroup/MoltenVK.git"
    ./build-moltenvk
  3. libplacebo

    git -C src clone --recursive "https://code.videolan.org/videolan/libplacebo.git"
    ./build-libplacebo
  4. dav1d

    git -C src clone "https://code.videolan.org/videolan/dav1d.git"
    ./build-dav1d
  5. FreeType & HarfBuzz

    git -C src clone "https://gitlab.freedesktop.org/freetype/freetype.git"
    git -C src clone "https://github.com/harfbuzz/harfbuzz.git"
    ./build-freetype -Dharfbuzz=disabled
    ./build-harfbuzz
    ./build-freetype
  6. libass

    git -C src clone "https://github.com/libass/libass.git"
    ./build-libass
  7. FFmpeg

    git -C src clone "https://git.ffmpeg.org/ffmpeg.git"
    ./build-ffmpeg
  8. mpv

    git -C src clone "https://github.com/mpv-player/mpv.git"
    
    # This will build and install mpv as CLI program
    ./build-mpv
    
    # Alternatively, you can make an app bundle by adding '--bundle' option
    # This will create mpv.tar.gz with mpv.app
    ./build-mpv --bundle
  9. Add /opt/local/bin to your $PATH.

Configuration

# ~/.config/mpv/mpv.conf

vo=gpu-next
gpu-context=macvk

Environment variables

  • MTL_HUD_ENABLED=1
    Enables the Metal Performance HUD.

  • MVK_CONFIG_LOG_LEVEL=3
    Enables verbose MoltenVK logging.

Dependency graph

graph TD;
   mpv-->ffmpeg;
   mpv-->libplacebo;
   mpv-->vulkan;
   mpv-->libass;
   libplacebo-->vulkan;
   vulkan-->moltenvk;
   ffmpeg-->libplacebo;
   ffmpeg-->vulkan;
   ffmpeg-->dav1d;
   ffmpeg-->libass;
   ffmpeg-->freetype;
   ffmpeg-->harfbuzz;
   libass-->freetype;
   libass-->harfbuzz;
   freetype-->harfbuzz;
   harfbuzz-->freetype;

About

A set of scripts that help build mpv with MoltenVK support.

Topics

Resources

Stars

Watchers

Forks

Languages