How to Configure mpv for Audio Passthrough?
This article provides a straightforward guide on configuring the mpv media player to pass through multi-channel audio formats—such as Dolby Digital (AC-3), DTS, and Dolby TrueHD—directly to an external audio receiver or soundbar. By modifying your configuration file or using command-line arguments, you can bypass system audio mixing and let your receiver handle the native surround sound decoding for the best possible audio quality.
Understanding Audio Passthrough in mpv
Audio passthrough (or bitstreaming) sends the encoded digital audio stream from your video file directly to your external hardware without any decoding or modification by your computer. This ensures that formats like 5.1 or 7.1 surround sound are processed exactly as intended by your home theater receiver.
Step-by-Step Configuration
To enable passthrough permanently, you need to edit your
mpv.conf file. The location of this file depends on your
operating system:
- Windows:
%APPDATA%\mpv\mpv.conf - Linux/macOS:
~/.config/mpv/mpv.conf
Open the file in a text editor and add the following lines based on your connection type and receiver capabilities:
1. Standard HDMI Passthrough (Recommended)
If your receiver is connected via HDMI and supports modern HD audio formats, add the following configuration:
# Enable hardware decoding bypass for major audio formats
audio-spdif=ac3,dts,dts-hd,truehd,eac32. Optical/Coaxial (S/PDIF) Connection
Optical cables have bandwidth limitations and cannot carry high-definition formats like DTS-HD or Dolby TrueHD. If you are using an optical connection, limit the passthrough to standard compressed formats:
# Enable passthrough strictly for formats supported by optical cables
audio-spdif=ac3,dts3. Setting the Correct Audio Output Device
Sometimes, your operating system’s default mixer will still interfere. You can force mpv to exclusively use your digital output by defining the audio device:
# Set the audio API (wasapi for Windows, alsa or pipewire for Linux)
ao=wasapi
# Force exclusive mode to prevent system sounds from mixing
audio-exclusive=yesTesting via Command Line
If you want to test the configuration before saving it to your file, you can run mpv directly from your terminal or command prompt using flags:
mpv --audio-spdif=ac3,dts,dts-hd,truehd --audio-exclusive=yes "your-video-file.mkv"
Troubleshooting Common Issues
- No Audio or Static: If you hear loud static, your
receiver likely does not support the specific format you are passing
through. Remove that format (e.g.,
truehd) from theaudio-spdiflist. - PCM output instead of Bitstream: Ensure that
audio-exclusive=yesis set, as Windows or macOS sound managers often force decoding to PCM if exclusive mode is turned off.