How to Auto Select Audio and Subtitle Language in mpv
This article provides a comprehensive guide on how to configure the mpv media player to automatically select your preferred audio and subtitle languages every time you open a video file. By modifying mpv’s configuration file, you can eliminate the need to manually toggle tracks for dual-audio anime, foreign films, or multi-language media. We will cover the specific configuration commands, where to place your configuration file across different operating systems, and advanced language prioritization techniques.
Editing the Configuration File
To automate language selection, you need to add specific lines to
mpv’s main configuration file, typically named mpv.conf.
The two primary options used for this are --alang (audio
language) and --slang (subtitle language).
You can specify languages using their standard ISO 639-1 (two-letter)
or ISO 639-2 (three-letter) codes. For example, en or
eng stands for English, and ja or
jpn stands for Japanese.
Recommended Configuration Settings
Open your mpv.conf file in a text editor and add the
following lines based on your preferences:
- For English Audio and English Subtitles:
alang=en,eng
slang=en,eng
- For Anime Fans (Japanese Audio with English Subtitles):
alang=ja,jpn,en,eng
slang=en,eng
- Setting Multiple Fallbacks: You can list multiple languages in order of preference, separated by commas. If the first language is not available in the video file, mpv will automatically move to the next one in the list.
alang=de,ger,en,eng
slang=de,ger,en,eng
Where to Find or Create
mpv.conf
Depending on your operating system, the mpv.conf file
needs to be placed in a specific directory. If the file or folder does
not exist, you can simply create them manually.
- Windows:
C:\Users\YourUsername\AppData\Roaming\mpv\mpv.conf(or in the same folder asmpv.exeif you are using a portable installation). - macOS:
~/.config/mpv/mpv.conf - Linux:
~/.config/mpv/mpv.conf
Advanced Behavior: Conditional Subtitles
If you want subtitles to appear only when the audio does not match
your native language, you can control the visibility behavior using the
sub-visibility flag or complex profiles. However, a common
setup to ensure subtitles always display when a language is matched is
to include:
sub-visibility=yes
By saving these preferences into your configuration file, mpv will seamlessly handle track selection in the background on every launch.