Giter Site home page Giter Site logo

mpv-scripts's People

Contributors

dyphire avatar porg avatar verygoodlee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mpv-scripts's Issues

Help wanted , installation

Hi, I want to install chapter-list.lua. as you mentioned it needs the scroll-list.lua.

I have the mpv-portable folder, I've created the

script-module and put the script in it, but nothing works.

Can you guide me step by step what to do?

[track-list.lua] Bug Report + Feature Request + Question

  • If subtitle's filename contains video's filename, this part is trimmed and ignored in the track list; and in the same way if the sub and video filenames are identical, no track name is shown at all. Is this a bug or is it on purpose? If it's the second, what can I do to always show the full track name?
  • A second keybinding press should hide the list, not reopen it. I'd like to press , for example, Ctrl+s to open the subs list and press it again to hide it. It would be much more intuitive than having to press ESC.
  • How to avoid showing these generic track names (Sub 11) for tracks with no name? Thus bringing back the old script behavior.

Screenshots for reference:
Screenshot (103)
image

chapter-make-read.lua Opening video file from NAS in large flat directory via SMB is very slow

Reproduction

  1. Move chapter-make-read.lua into ~/.config/mpv/scripts/
  2. Open a local video file → Opens local video file plus chapter sidecar file if existent → ✅ Works in an instant.
  3. Open video file on NAS from folder which has 500+ video files → ❌ Takes 2-3 minutes to open and start playback!
  4. Move chapter-make-read.lua from ~/.config/mpv/scripts/ to ~/.config/mpv/scripts-off/
  5. Open video file on NAS → ✅ Takes the usual ca. 3 secs again. No chapter functionality ofc.
  6. Move chapter-make-read.lua back to ~/.config/mpv/scripts/ and move the video into a folder with no or only few sister files.
  7. Open video file on NAS → ✅ Takes the usual ca. 3 secs again. The chapters are shown.

Suspicion

  • When mpv opens video-filename.videoSuffix the script looks for the existence of the sidecar file video-filename.videoSuffix.chp
    • But "just looking for a single file of a certain name" in the context of a network share, seems to get translated into multiple system calls:
      • Get a fresh directory listing (that may take long with all metadata and file thumbnail refreshing (loading in the first N bytes)!)
      • And among that listing search for the file.
  • From the lua script's perspective it is just using file access, it is likely not aware whether that file is locally or on a NAS.

Possible improvements

  1. Make lua file access aware whether it is local or network. And if network, make a call which really only searches for the existence of a file and avoid a large flat directory refreshing. → I estimate this to be not possible at all, or too much effort to implement (especially multi platform!)
  2. Workaround: Exclusion-list or inclusion-list of filepaths for loading chapter files.
    • Possibility to list multiple folder names and/or file names and/or filepaths for which to (not) open chapters:
    • Ideally this supports wildcards or RegEx, and has an easy way to distinguish file vs. folder,
    • e.g. the rsync include/exclude syntax would be a good existing syntax to use.

[track-list.lua] Some feature requests

  • Don't count None track in the total number of tracks. If possible, setting its ID to 0 would be a good solution I suppose. OR: Show track numbering on the list, to make it more easy and intuitive to figure out what's the actual track ID.
  • Don't show <TrackType> <TrackID> when track has no name, just left it empty. I mean: I don't want to see tracks appearing like Audio 01 if the audio track has no name.
  • Option to show extension in uppercase, instead of language.

the absence of a comma and a space between the codec and the track language in track-menu.lua

I noticed that there is no comma between the language and the codec of the track, although other data is separated by a comma, my inner perfectionist is indignant.
is it still possible to add a path mapping to external files?

image
I wanted to ask if it is possible to change the colors of these elements? I didn't find the settings to change them
image
and what are these functions? [%cursor%/%total%]
does it look broken?
image

about fix-avsync.lua
the script works, but when you switch the track, the sound creaks, breaks for half a second, is it possible to fix it, for example, by silencing the track for 1 second between switching?

about open_dialog.lua
is it possible to make it so that by selecting an external track, it immediately becomes the default in the player?

Chapters not getting displayed

chapters.txt

00:00:00.000 Largo (The sick man, near death)
00:05:24.000 Allegro molto agitato (The battle between life and death offers no respite to the man)
00:09:09.000 Meno mosso (The dying man's life passes before him)
00:17:09.000 Moderato (The sought-after transfiguration) 

chapter_make_read.conf

#Whether to enable automatic reading and loading external chapter files.Default: yes
autoload=yes
#Whether to enable the automatic export chapter file (when the chapter information is changed).default:no
autosave=no
#Whether to use external chapter information to cover the internal chapter information of the video.default:no
force_overwrite=no
#Specifies the extension of the external chapter file.
chapter_file_ext=.txt
#Select whether the external chapter file needs to match the extension of the source file.
basename_with_ext=no
#Specifies the subpath of the same directory as the playback file as the external chapter file path.
#Note: The external chapter file is read from the subdirectory first.
#If the file does not exist, it will next be read from the same directory as the playback file.
external_chapter_subpath=chapters
#Whether the chapter file is stored in the configuration global directory, the network file will always use the global directory.default:no
global_chapters=no
#Specify the path of the global directory of the chapter file.It can be the relative path or absolute path supported by MPV
global_chapters_dir=~~/chapters
#Whether to use the hash value to save the file name in the global directory.Default: no
## If you set to 'no', the chapter file will be named after the corresponding media documents, which may lead to conflict
## Using hash can prevent the same name, but in different directory media files to obtain the same chapter file
## But if you move the file to different directory, the hash value will be changed so that the chapter file cannot be loaded
hash=no
#ask for title or leave it empty
ask_for_title=yes
#placeholder when asking for title of a new chapter
placeholder_title=Chapter 
#pause the playback when asking for chapter title
pause_on_input=yes

Log

mpv Richard\ Strauss\ :\ Tod\ und\ Verklärung\ \(Mort\ et\ Transfiguration\)\ \(Mikko\ Franck\ ⧸\ OpRF\).00-25-43.2018-12-27.umfttWN5xYo.webm  -v --log-file=./log

chapter-make-read.lua accepts chapter filenames with 2 or 3 letter language codes

Imagine this file structure

video.mp4           # Video file
video.chp           # Chapter file, language neutral
video.mp4.chp       # Chapter file, language neutral, video suffix included
video.chi.chp       # Chinese chapter file, 3-letter code (ISO 639‑3), 
video.en.chp        # English chapter file, 2-letter code (ISO 639‑1)
video.spa.chp       # Spanish chapter file, 3-letter code (ISO 639‑3)
video FR.chp        # French chapter file, 2-letter code (ISO 639‑1) at the end of the file name without a dot

Detection

  • If we have #15 then the .chp file can also be associated to the video file without the video file suffix.
  • The language code can be identified if immediately before the .chp, in lowercase, uppercase, prefixed by a non-alphanumeric character, so dot, space or also hyphen, etc. See mpv option --options-sub-auto

Utilization

  • If there is only one chapter file, then use it right away, no questions asked.
  • If there are chapter files available in different languages then
    • in v1 the script chooses according to the mpv Track Selection preferences:
      • Already offers --alang (audio) , --vlang (video), --slang (subtitles), so you could introduce --clang (chapters)
      • If no --clang is present it uses --slang: If you can read the subtitles in that language, you can also read the chapters in that language.
      • For some obscure reasons you may want the original language chapter names (e.g. for reference) but nevertheless watch in your preferred subtitle language.
    • in v2 the script may allows to switch languages interactively (like subtitles already can)
    • in v3 the script may allows to switch language interactively in tandem with the subtitle files if you have exactly the same set of chapter languages and subtitles languages in total (from the video file stream and/or loaded from sidecar files)

chapter-make-read.lua - manually importing _chapter.chp file

Thanks for the script.

It is easily and automatically imported.

I am just wondering how to manually import the chapter.chp file.
Can you guide me on this?


I have to repeat this twice for the most recently created chapter.
s script-message-to createchapter create_chapter; script-message-to chapter_make_read write_chapter


How to add a file title into the chapter file name, instead create_chapter.chp?

[open_dialog.lua] import_clipboard breaks the script if the pasted text is in quotes

I tried to paste some file paths I copied with Windows File Explorer context-menu, which comes in quotes, and the file fails to open; and yet more, this error makes the entire script to completely stop to work.

Additionally, it would be good if the script printed osd messages about its actions ("Opening file...", "Loading URL...", etc), errors, etc.

Chapter - Missing.

The first chapter is missing.
And needed to write the chapter name that doesn't save as I chose a name.

chapter-make-read.lua - Fails with realistic amount and names for chapters - Works with minimal chapter file

Reproduction

  1. Installed chapter-make-read.lua by moving it into ~/.config/mpv/scripts/
  2. Put sidecar chapter file next to video file:
    • EVM.m4v (49m 28s, no chapters in metadata)
    • EVM.m4v.chp (UTF-8, created with TextEdit)

Result: Chapter loading ✅ works from very minimal but unrealistic chapter file ❌ but fails with realistic chapter file.

✅ Very minimal but unrealistic chapter file

  • 4 chapters
  • 0:00:00 til 0:40:00
  • Chapters max 3 words, ASCII [A-Za-z ] only, no punctuation whatsoever

❌ My realistic chapter file

  • 32 chapters
  • 0:00:00 til 0:31:37
  • Longest line 92 characters (timestamp plus chapter text)
  • Used characters: [A-Za-z ] (ASCII only!) and several punctuation characters such as ' " , . : … • & / ( )

Investigation

  • Tried a lot of trial and error. Could not find the root cause.
  • Performed several test rounds
      1. Start with original chapter file
      1. Reduce a certain character from the file (e.g. hyphen, dot, colon, ampersand, ...) by find/replace.
      1. Save file.
      1. Reopen mpv with that file.
      1. Quit mpv again
    • Go back to 1. Several times
  • Then also tried to cut the maximum line length to e.g. 20 characters.
  • Checked that my filestamps are a continuum (no timestamp earlier than the previous timestamp)
  • All helped nothing. Was left clueless.

Environment

  • macOS 11 Big Sur
  • mpv 0.35.0 (installed via brew package manager)

Attachments

Notes

  • The .txt extension was only added to be accepted as an attachment on Github
  • During playback attempt the respective files were of course renamed to EVM.m4v.chp to act as the sidecar file to EVM.m4v.chp

Files

chapter-make-read.lua: Autodetection of sidecar file also for basename.chp

  • Currently: The sidecar is the full file name including the video suffix + the .chp extension
  • Proposed: It should also detect the file name without the video suffix + the .chp extension
    • Design rationale: That's common for subtitle files like .SRT, see mpv option --options-sub-auto
    • In the macOS Finder the handling of files with two file extension is a bit inconvenient when renaming files. Would prefer .chp as the sole extension for this reason too.
  • Note: The current sidecar file detection pattern shall remain too.
    • That way per use case you can be either ultra specific or more tolerant/flexible with how you name your chapter files, e.g.
      • vid.mp4 + vid.mp4.chp + vid.avi + vid.avi.chp all matching uniquely
      • whereas vid.chp would be a sidecar file to both vid.mp4 and vid.avi

chapter-make-read.lua: adding and writing chapters works, but loading fails at mpv start in command line.

Hi,
I just found your script collection and tried to use chapter-make-read.lua.
Creating chapters and writing the file works, but when I close and restart mpv, the chapters file isn't imported. I assume it's because I don't have 'mp.msg', 'mp.utils', and "mp.options" which are listed as "required" in your script (unless they're mpv builtins).
However, I could not found any info if they are mpv builtins and if not where to get them.

I think that for users who are not very experienced with lua scripts, it would be helpful to add a little bit of explanation in the README.

Thanks, Markus

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.