mpv .lua scripts are extremely powerful. Unlike a web browser, mpv does not "sandbox" its scripts. This means a script has the same permissions as your Windows user account: it can read/write files, execute system commands, and access the network.
How do I know a script is safe?
You should never put a script into your mpv folder unless you trust the source or have verified the code. For those who aren't programmers, the most "noob-proof" method is to use AI as a safety auditor:
Verification:
Always ensure that the .lua file you download/save matches the code displayed on this page. While this site is served securely via GitHub and Cloudflare, "supply chain" attacks can happen. If a source repository is ever compromised, the code could be changed without notice. Always inspect what you execute.
This script automates audio and subtitle selection in MPV.
MPV will automatically load your preferred languages for both audio and subtitles. The player will also distinguish between full dialogue and signs/songs based on your audio selection, even updating subtitles instantly when you switch audio tracks.
track-selector.lua in your mpv scripts folder.
C:\Program Files\mpv\portable_config\scripts)
preferred_lang_codes,
preferred_lang_Forced_Subs_Keywords and
preferred_lang_Normal_Subs_Keywords
sections inside the User Configuration.
es-419 for Latin American Spanish, then es and spa).
preferred_lang_codes) : {"it", "ita"} → {"es-419", "es", "spa"}
preferred_lang_Forced_Subs_Keywords): {"cartell", "forzat"} → {"whatever", "keywords"}
preferred_lang_Normal_Subs_Keywords): {"dialog", "complet"} → {"whatever", "keywords"}
Loading script content...