Fully automatic subtitle downloading for the MPV media player
This Lua script uses the Python program subliminal to download subtitles. Make sure you have both installed:
pip install subliminal
Copy autosub.lua into:
OS | Path |
---|---|
Windows | [Drive]:\Users\[User]\AppData\Roaming\mpv\scripts\ |
Mac/Linux | ~/.config/mpv/scripts/ |
mkdir ~/.config/mpv/scripts
cat > ~/.config/mpv/scripts/autosub.lua
[Paste script contents and CTRL+D]
Specify the correct subliminal location for your system:
To determine the correct path, use:
OS | App | Command |
---|---|---|
Windows | Command Prompt | where subliminal |
Mac/Linux | Terminal | which subliminal |
Copy this path to the subliminal variable at the start of the script:
local subliminal = '/path/to/your/subliminal'
On Windows, the backslashes in the path need to be escaped, e.g.:
C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python37\\Scripts\\subliminal.exe
b
,n
.auto
bool to false
.This script is under the MIT License,
so you are free to modify and adapt this script to your needs:
check out the MPV Lua API for more information.
If you find yourself unable to find the correct subtitles for some niche movies/series, you might be interested in the submod command line tool I've written to manually correct subtitle timing.
Inspired by selsta's and fullmetalsheep's autosub scripts.