All Projects → Ben-Kerman → mpv-sub-scripts

Ben-Kerman / mpv-sub-scripts

Licence: other
Two mpv scripts for automatically pausing after each subtitle line and skipping intervals between subtitles.

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to mpv-sub-scripts

immersive
Language learning mpv script for looking up words within mpv and generating Anki cards
Stars: ✭ 43 (-6.52%)
Mutual labels:  language-learning, subtitles, mpv-script
mpvacious
Adds mpv keybindings to create Anki cards from movies and TV shows.
Stars: ✭ 286 (+521.74%)
Mutual labels:  language-learning, subtitles, mpv-script
subadub
Chrome+Firefox extension for studying foreign languages using Netflix subtitles
Stars: ✭ 103 (+123.91%)
Mutual labels:  language-learning, subtitles
jimaku-player
Use your own subtitles on VRV or Crunchyroll to learn Japanese!
Stars: ✭ 48 (+4.35%)
Mutual labels:  language-learning, subtitles
HelloWorlds
Hello-World program in most programming languages
Stars: ✭ 102 (+121.74%)
Mutual labels:  language-learning
EuroRomCom
🇪🇺 Resources and Learning Games for European Romance Language Communication
Stars: ✭ 16 (-65.22%)
Mutual labels:  language-learning
custom-subs
Anime Subs
Stars: ✭ 58 (+26.09%)
Mutual labels:  subtitles
Ailab
Experience, Learn and Code the latest breakthrough innovations with Microsoft AI
Stars: ✭ 6,896 (+14891.3%)
Mutual labels:  language-learning
subtitleeditor
Subtitle Editor is a GTK+3 tool to create or edit subtitles for GNU/Linux/*BSD.
Stars: ✭ 79 (+71.74%)
Mutual labels:  subtitles
cfg
my dotfiles
Stars: ✭ 26 (-43.48%)
Mutual labels:  mpv-script
mpv-file-browser
A simple no-dependency file browser for mpv player
Stars: ✭ 139 (+202.17%)
Mutual labels:  mpv-script
guide.encode.moe
A guide for fansubbing
Stars: ✭ 123 (+167.39%)
Mutual labels:  subtitles
matroska-subtitles
💬 Streaming parser for embedded .mkv subtitles.
Stars: ✭ 40 (-13.04%)
Mutual labels:  subtitles
RenameThemSubs
Rename multiple subtitles files to match video file names for automatic loading with just one click
Stars: ✭ 40 (-13.04%)
Mutual labels:  subtitles
Game2Text
Complete toolbox for gamifying language learning
Stars: ✭ 86 (+86.96%)
Mutual labels:  language-learning
SABRE.js
Substation Alpha suBtitles REnderer -- A Gpu Accelerated Javascript Advanced SubStation (ASS) Alpha Subtitles Renderer. Renders .ass and .ssa files.
Stars: ✭ 58 (+26.09%)
Mutual labels:  subtitles
mpv-scripts
A collection of scripts for mpv player
Stars: ✭ 138 (+200%)
Mutual labels:  mpv-script
almanca
Almanca dilbilgisi ve gramer notlari / Lesson notes I have taken to learn the German language beginning from A1.
Stars: ✭ 15 (-67.39%)
Mutual labels:  language-learning
ttml2srt
convert TTML subtitles to SRT subtitles
Stars: ✭ 46 (+0%)
Mutual labels:  subtitles
mpv-ytdlautoformat
A simple mpv script to auto change ytdl-format for Youtube and Twitch
Stars: ✭ 30 (-34.78%)
Mutual labels:  mpv-script

sub-pause

An mpv script that automatically pauses before and/or after each subtitle line. Mostly intended for language learning.

Key Bindings

  • (none): toggle auto-pause at start of line (toggle-start)
  • n: toggle auto-pause at end of line (toggle-end)
  • Alt+r: skip next pause (skip-next)
  • Ctrl+r: replay active line, always available (replay)

To use a key binding other than the defaults above add a line like the following to your input.conf (where X is the binding and <action_id> is the value in parentheses in the list above):

X script-binding sub_pause/<action_id>

sub-pause-toggle-start doesn't have a default binding and must be assigned manually.

If you want a binding for both replaying and skipping add a line like this:

Ctrl+Alt+SPACE script-binding sub-pause-replay; script-binding sub-pause-skip-next

sub_pause/ can be left out, however events triggered from bindings defined without it will be sent to all scripts, which can lead to conflicts if two scripts use the same action ID.

When using scoped actions, the script ID before / is derived from script's filename, with the extension removed and all characters except alphanumeric ASCII characters (A-Z, a-z, 0-9) replaced by _.

Configuration

Create a file at script-opts/sub_pause.conf in your mpv config directory:

# To set a value remove the leading # and modify it after the =.
# All values given here are defaults. Seconds can be decimal values.

# if set to 'yes', enable pausing at the start of each line by default
#default_start=no

# if set to 'yes', enable pausing at the end of each line by default
#default_end=no

# pause roughly this many seconds before the end of each line
# very low values can result in the line no longer being active after pausing
#end_delta=0.1

# if autopausing is enabled, hide subtitles while not paused
#hide_while_playing=no

# automatically resume playback this many seconds after autopausing
# no effect if less than or equal to zero
#unpause_time=0

# if unpause_time is set, prevent the next automatic unpause by pressing this key
# can be anything that would be an acceptable key binding in mpv's input.conf
#unpause_override=SPACE

Known Issues

If there are multiple subtitles visible at the same time (e.g. one at the top and one at the bottom, or on-screen text with SubStation Alpha(ASS) subs) the script will only pause at the end of the last visible line. While it would be possible to fix this at least some of the time by saving every change in the subtitle end time this(in my opinion) doesn't justify the additional complexity considering how rare such situations are.


If you come across any other problems while using the script feel free to open a GitHub issue or send a pull request.

sub-skip

This script allows automatically skipping parts of a video that don't contain any subtitles. Skipping can be done either by speeding up playback while no subtitles are present or by seeking to the start of the next subtitle line, skipping the interval between lines entirely.

How To Use

The script works by briefly changing subtitle delay so that the next line starts at the current video/audio time, recording the difference between the original and shifted subtitle delay and then speeding up or seeking to the start of the next line (calculated from the difference).

This works best if mpv is forced to always demultiplex enough of the video for the next subtitle line to be almost always available by setting demuxer-readahead-secs to a value between 60-120 in mpv.conf. Alternatively, enabling cache for all videos with cache=yes also works.

If demuxer readahead or cache are not set explicitly it is possible for the next subtitle line to be unavailable even if it starts within the next few seconds. The script can deal with this but works best if one of the config entries from above is set.

Key Bindings

  • Ctrl+n: activate skipping (toggle)
  • Ctrl+Alt+n: toggle between speedup and seek skip (switch-mode)
  • Ctrl+Alt+[: decrease skip speed by 0.1 (decrease-speed)
  • Ctrl+Alt+]: increase skip speed by 0.1 (increase-speed)
  • Ctrl+Alt+-: decrease skip interval by 0.25s (decrease-interval)
  • Ctrl+Alt++: increase skip interval by 0.25s (increase-interval)

When changing the interval using the numpad +/- keys, it might be necessary to also press shift, even if it's not part of the binding.

As explained for sub-pause, additional bindings can be assigned in input.conf:

X script-binding sub_skip/<action_id>

Configuration

Create a file at script-opts/sub_skip.conf in your mpv config directory:

# To set a value remove the leading # and modify it after the =.
# All values given here are defaults. Seconds can be decimal values.

# if set to 'yes', enable skipping by default
#default_state=no

# if set to 'yes', use seek mode by default
#seek_mode_default=no

# any interval between subtitle lines longer than this value in seconds will be skipped
#min_skip_interval=3

# what speed to use while skipping if not in seek mode
#speed_skip_speed=2.5

# how many seconds after the end of a line to wait for before starting to skip
#lead_in=0

# how many seconds before the start of the next line to stop skipping at
#lead_out=1

# how much to change skip speed by when invoking sub-skip-{de,in}crease-speed
#speed_skip_speed_delta=0.1

# how many seconds to change the minimum interval by when invoking sub-skip-{de,in}crease-interval
#min_skip_interval_delta=0.25

sub-skip is inspired by and partially based on speed-transition from https://github.com/zenyd/mpv-scripts, but rewritten from scratch.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].