GithubHelp home page GithubHelp logo

lypheo / mpv-subtitle-lines Goto Github PK

View Code? Open in Web Editor NEW

This project forked from christoph-heinrich/mpv-subtitle-lines

0.0 0.0 0.0 285 KB

List and search subtitle lines of the selected subtitle track

License: GNU General Public License v2.0

Lua 100.00%

mpv-subtitle-lines's Introduction

mpv-subtitle-lines

List and search subtitle lines of the selected subtitle track, that mpv has already loaded internally.
No need for external tools (e.g. ffmpeg), no need to reload the same subtitles mpv has already loaded.

Select a line to seek to it's start time.

screenshot

Requires uosc 5.0.0 or newer.

Installation

  1. Save the subtitle-lines.lua into your scripts directory
  2. Set key bindings in input.conf
    Ctrl+f script-binding subtitle_lines/list_subtitles
    

Recommended usage

When turning on subtitles, mpv loads subtitles from the current playback time forward. Therefore it is recommended to always have subtitles selected.
For example here is a mpv.conf configuration for English and German, with a preference for English.

slang=eng,ger
subs-with-matching-audio=yes
ytdl-raw-options-append=sub-langs=en.*,de.*

"But I don't want to always see subtitles."

Then hide them when the audio language is a language you understand using a conditional auto profile.
For example to hide subtitles when the audio language is English or German and the subtitles are not forced:

[hide-subtitles]
profile-cond=not get('current-tracks/sub/forced') and (function() local hide_for = {'en','eng','de','deu','ger'} local a = get('current-tracks/audio/lang') a = a and a:match('^%w+') for _, hl in ipairs(hide_for) do if a == hl then return true end end end)()
profile-restore=copy
sub-visibility=no

Unfortunately the audio track doesn't always have a language set, in which case the subtitles won't be hidden with this. However that situation seems to be rare in practice.

Current limitations

  • Only lists subtitles that mpv has loaded internally.
  • After seeking mpv only provides the current subtitle line and requires some (short) playback for the other lines to become available.
  • Acquiring subtitle lines isn't 100% accurate.

Resolving those requires changes to mpv or external tools.

mpv-subtitle-lines's People

Contributors

christoph-heinrich avatar lypheo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.