Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The button to loop the current video on the current subtitle fragment #177

Closed
bakustarver opened this issue Aug 15, 2023 · 4 comments
Closed
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@bakustarver
Copy link

bakustarver commented Aug 15, 2023

I request to add a button to loop the video on the fragment of the current subtitles

The button will look something like that
example

@bakustarver bakustarver changed the title Button to loop the current subtitle segment To loop the current video on a segment of the current subtitles Aug 15, 2023
@bakustarver bakustarver changed the title To loop the current video on a segment of the current subtitles The button to loop the current video on the current subtitle fragment Aug 15, 2023
@mansuen
Copy link

mansuen commented Aug 15, 2023

This can be achieved by going to Settings > Open Config Folder, and then creating (I think it's not there by default) a text file "input.conf" and pasting this:

ENTER sub-seek 0

Then the Enter key will replay the current subtitle segment. Correct me if I'm wrong.

@ripose-jp ripose-jp added enhancement New feature or request wontfix This will not be worked on labels Aug 16, 2023
@ripose-jp
Copy link
Owner

Like mansuen said, you should just add a bind in your mpv.conf. There's no reason to add a button unless you're using something like a Steam Deck.

@bakustarver
Copy link
Author

The code that mansuen posted actually activates this button:

new
It rewinds to the beginning of the current subtitle.
You can also use the "" key in Memento to rewind to the beginning of the current subtitle segment.

I'm writing about something else, about looping the beginning of the current subtitle segment with the end of the current subtitle segment

Subtitles in srt format, for example:
1
00:00:18,760 --> 00:00:22,100
🡡                            🡡
the beginning --> the end
目が覚めた場所には

2
00:00:22,100 --> 00:00:25,600
🡡                            🡡
the beginning --> the end
白い壁 保健室

make a loop with subtitle fragment 1:
make the video player load video only from 18.760 sec to 22.100 sec.

The same with 2
load the video in the segment from 22.100 to 25.600 seconds

MPV already has a function to loop two AB points by pressing the L key three times (works in Memento as well).

In general, simplify looping a video, with a single click on the current subtitle segment, by using a button, or hotkey

@ripose-jp
Copy link
Owner

The code that mansuen posted actually activates this button:

That button executes sub-seek -1.

It rewinds to the beginning of the current subtitle.

It goes to the last subtitle.

You can also use the "←" key in Memento to rewind to the beginning of the current subtitle segment.

It goes 10 seconds backwards in the video.

Corrections aside, I don't see the value in implementing the feature internally in Memento since the same functionality can be achieved through some button presses or through a Lua script if you want to get specific. Implementing features like this in C++ is just unneeded baggage in my opinion. The type of features that should be implemented in Memento are ones that either can't easily be scripted into mpv or can be done significantly better in C++.

Since exactly what you want doesn't already exist from what I can find, I recommend you learn Lua and mpv's API. Lua is a simple language. mpv's API has a learning curve due to its documentation, but essentially all you'll be doing is binding a hotkey that gets the sub-start and sub-end properties and sets an A-B loop. It shouldn't be more than a few lines of code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants