root

autospeed

An mpv plugin automatically adjusting the playback speed when the subtitles are being shown. It allows the user to speed up the movies when there are no dialogues at the moment, with mpv automatically slowing down when the dialogues happen.

INSTALLATION

Copy/symlink the autospeed.lua file to ~/.config/mpv/scripts/.

Optionally copy script-opts/autospeed.conf to ~/.config/mpv/scripts-opts/ and adjust the default values.

CONFIGURATION

The config file keys:

  • enable (boolean): whether to automatically enable the speed adjustment and the initial speeds defined in the config. The initial action_speed triggers only after the first subtitles disappear.
  • keys (boolean): bind the default keys or not
  • action_speed (number): the initial non-dialogue playback speed
  • dialogue_speed (number): the initial dialogue playback speed

Messages that may be invoked from ~/.config/mpv/input.conf:

  • autospeed-enable: enable the speed adjustment on demand even if it's disabled in the config file. If it's already enabled, reset the speeds according to the config file.
  • autospeed-disable: turn of the automatic speed adjustment and unbind the keys bound with the keys option
  • autospeed-toggle: toggle the automatic speed adjustment (the same as calling autospeed-enable and autospeed-disable as appropriate)
  • autospeed-change <mode> <multiplier>: change the given mode's (action or dialogue) speed by multiplier

The keys config option is roughly equivalent to the following snippet, with the added benefit of being loaded and unloaded with the usage of autospeed-toggle/autospeed-enable/autospeed-disable and some other goodies:

[ repeatable script-message-to autospeed autospeed-change action 0.90909090909091
] repeatable script-message-to autospeed autospeed-change action 1.1
Alt+[ repeatable script-message-to autospeed autospeed-change dialogue 0.909090909091
Alt+] repeatable script-message-to autospeed autospeed-change dialogue 1.1

WORKFLOW

The workflow suggested by the author

Keep the plugin disabled by default (enable=no) and add the following line to ~/.config/mpv/input.conf, which will allow to toggle the automatic adjustments with the \ key:

\ script-message-to autospeed autospeed-toggle

Set action_speed set as fast as intended and dialogue_speed equal or close to 1.0 (1.21 is a good value). Both speeds should be powers of 1.1 for the [ & ] keys to work consistently i.e. able to reach 1.0 if needed.

keys=yes should be set unless there is a good reason not to.

This way when the movie plays, it starts without the automatic adjustments, so the plugin won't disrupt the most usual scenario. If the auto-adjustments are wanted, they can be easily enabled and possibly disabled/toggled later.

For some movies it may be a good idea to enable the auto-adjustments with the \ key, immediately follow with the backspace to reset both speeds to 1.0, and finally manually set some less extreme speeds than the ones used most often i.e. the ones in the config.

Copyright (C) 2020 Wojciech Siewierski

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.