SMPlayer (wikipedia)
Thu, 03/31/2016 - 16:37

SMPlayer is powerful GUI for mplayer and for some time form mpv too. It already has UI for downloading subtitles from, but that's all you can do with online subtitles. Fortunately mpv comes to rescue with it's support for .lua scripts.

On from pantheon of user scripts is find_subtitles.lua, which add option to download subtitles automatically after pressing one key. But not so fast, first you'll need python tool subliminal.


I've had some trouble installing this tool when I followed guide and used pip install, in case anyone has same problem, here is how I installed it from repository. Which brings one plus, I can use latest version from devel branch (I love having latest tools):

git clone
cd subliminal
git checkout develop
sudo python install

Now try if everything works fine by running subliminal you should see help.

I case you want to use python3 version, just install it by sudo python3 install.

Well, that's a good start, now how to use this with SMPlayer.

SMPlayer + MPV lua scripts

You can find quick guide on how to use find_subtitles in repository. Download the find_subtitles.lua script to folder ~/.config/mpv/scripts. Now just open mpv and download subtitles to currently playing video by pressing s.

With SMPlayer it's a bit more complicated. I wasn't able to use keyboard shortcuts to control mpv script, so I decided to execute script on every file open. Then I just open video file, wait few seconds and voila, subtitles are there. I added to script just one line:

mp.register_event("start-file", find_subtitles)

then I commented line 22 and uncommented line with addic7ed (I want to use this provided too), where I added my credentials

local ss = os.capture("subliminal --addic7ed USER PASSWORD download --provider addic7ed --provider opensubtitles --provider podnapisi --provider thesubdb --provider tvsubtitles -l en -v '" .. mp.get_property("path") .. "'")

Lua script is ready, now we need to configure SMPlayer. MPV under SMPlayer is by default started without scripts, so we need to change one setting. In Preferences (CTRL+P) -> Advanced -> Options for MPlayer/mpv add to Options parameter which starts mpv with our script:

--script ~/.config/mpv/scripts/find_subtitles.lua

That's it, now just open video and subtitles are downloaded automatically.