Home

Awesome

autosubsync-mpv

Automatic subtitle synchronization script for mpv media player, using ffsubsync. This is a fork of autosub, and it's meant to work nicely alongside autosub, trueautosub or similar scripts.

For support of alass, other subtitle formats, synchronization using an existing subtitle, and some other things check out this branch. You should probably use this one if you're using an updated version of mpv, since master branch is intended to support older, deprecated versions such as the ones in official Debian/Ubuntu repos.

Installation

  1. Install ffsubsync. You can simply use pip install ffsubsync, assuming you already have ffmpeg installed.
  2. Download autosubsync.lua or clone the repo.
  3. If your ffsubsync path isn't the default, create a config file at ~/.config/mpv/script-opts/autosubsync.conf (GNU/Linux) or %AppData%\mpv\script-opts\ (Windows) and add the correct path. For example:
subsync_path=/usr/local/bin/ffsubsync
  1. Move autosubsync.lua to your scripts folder. This is typically in ~/.config/mpv/scripts (GNU/Linux) or %AppData%\mpv\scripts\ (Windows).

Usage

When you have an out of sync sub, press n to synchronize it.

ffsubsync can typically take up to about 20-30 seconds to synchronize (I've seen it take as much as 2 minutes with a very large file on a lower end computer), so it would probably be faster to find another, properly synchronized subtitle with autosub or trueautosub. Many times this is just not possible, as all available subs for your specific language are out of sync. Take into account that using this script has the same limitations as ffsubsync, so subtitles that have a lot of extra text or are meant for an entirely different version of the video might not sync properly.

Note that the script will create a new subtitle file, in the same folder as the original, with the _retimed suffix at the end.

Issues

If you are having trouble getting it to work, feel free to open an issue, but try to check if ffsubsync works properly outside of mpv first. When ffsubsync isn't working, autosubsync will likely fail. If you do open an issue, please try to include mpv's output to the terminal.

Possible improvements