The button to loop the current video on the current subtitle fragment
bakustarver opened this issue · 4 comments
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.
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.
The code that mansuen posted actually activates this button:
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
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.