How to Use External Audio in mpv?
This article provides a quick guide on how to load and play an external audio track alongside a video file in the mpv media player. You will learn the specific command-line arguments needed to sync a separate audio file, how to select that track within the player, and how to automate the process for files with matching names.
Using the Command Line
The most direct way to load an external audio track in mpv is by
using the --audio-file option in your terminal or command
prompt. This tells mpv to open the video file and fetch the audio from a
completely separate file.
mpv video.mp4 --audio-file=audio.mp3If your audio file path contains spaces, make sure to wrap the path in quotes:
mpv "my video.mp4" --audio-file="my audio.m4a"Selecting the Audio Track Inside mpv
Once mpv opens, it might still default to the video’s original audio track. You can easily switch to your newly loaded external track using keyboard shortcuts.
- Press the
#key (Shift + 3) to cycle through the available audio tracks. - Look at the on-screen text (OSD) to confirm when your external track is active.
Auto-Loading Matching Audio Files
If you frequently play videos with external audio tracks, you can configure mpv to detect and load them automatically. This works best when the audio file shares the exact same name as the video file (excluding the extension).
To enable this, add the following line to your mpv.conf
configuration file:
sub-auto=all
audio-file-auto=exact
Setting audio-file-auto=exact tells mpv to automatically
look for and load any external audio file that matches the video’s
filename in the same directory.