You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks for the speed-transition.lua script! It's really useful.
I don't know how easy it is to achieve, but I'd love if the script could ignore subtitles that are shorter than a certain length, since very short subtitles can be read quickly even at high speeds, and often they just contain something like ♪♫ when music is played.
I think regex might be useful for that, so that one could also ignore subtitles where the whole text is enclosed in square brackets, which are often used to describe sounds.
changed the title [-]speed-transition.lua: Ignore subtitles with text shorter than a configurable amount.[/-][+]speed-transition.lua: Ignore subtitles that match a regex pattern[/+]on Nov 10, 2020
I currently have a feature similar to this in a pending pull request. It is much simpler though. It is just a table of characters that if exist at all in the subtitle, it will will ignore that line.
In case it might be of use, I've converted my above regex into Lua patterns. I didn't know Lua had no regex included, since I have basically no Lua experience. I've also added two characters from your change:
ignoredCharacters="#♯♩♪♬♫🎵🎶"-- Test strings:s=" [ loud noise ] " --s = " How are you doing? "--s = " ♫ la deda ♪ "--s = " why "--s = " ♯🎵# "--s = " Hey, it's just a ♪ character! "localst=s:gsub("^%s*(.-)%s*$", "%1") -- trim stringlocalign=ignoredCharacterslocalisLikelyAudioSub=st:len() <4orst:find("^%[.*%]$") orst:find("^[" ..ign.."]+.*[" ..ign.."]+$") orst:find("^[ " ..ign.."]+$")
print(isLikelyAudioSub)
@bitingsock Just noticed something, and I think this was also the case previously.
When using subtitles that cannot easily be converted to text (e.g. image based ones), the script doesn't work at all.
I'm not sure what the cause is, but sub-stepping seems to work. You can step from one subtitle to the next. (Of course the match filter can't work without the actual text)
Correct, it has always only worked on Text bases subs. However, there may be some way to make a way using pure sub-stepping based on properties that are already triggering the functions. I'll have to think about that.
Not sure how useful, but one thing I've tried is to make speed_transition get triggered by a sub-start property change (instead of sub-text, whose value is then manually requested).
However, it seems that with image-based subtitles both sub-start and sub-text only trigger once, and then never again, which might be why it doesn't work.
Either I'm missing something, or this is a bug in mpv.
Just found this plugin of yours (which inspired the speed-transition one), and it seems like it would avoid that problem by calling a function periodically (not tried).
Activity
[-]speed-transition.lua: Ignore subtitles with text shorter than a configurable amount.[/-][+]speed-transition.lua: Ignore subtitles that match a regex pattern[/+]bitingsock commentedon Feb 14, 2021
I currently have a feature similar to this in a pending pull request. It is much simpler though. It is just a table of characters that if exist at all in the subtitle, it will will ignore that line.
CreamyCookie commentedon Feb 14, 2021
@bitingsock Thanks a lot! This is great.
In case it might be of use, I've converted my above regex into Lua patterns. I didn't know Lua had no regex included, since I have basically no Lua experience. I've also added two characters from your change:
bitingsock commentedon Feb 14, 2021
Cool, I'll try to implement this.
bitingsock commentedon Feb 21, 2021
I got the pattern match working: https://github.com/bitingsock/mpv-scripts/blob/patch-4/speed-transition.lua
Waiting for pull approval, but you can use that one in the meantime.
CreamyCookie commentedon Feb 21, 2021
@bitingsock Thanks a lot! =)
CreamyCookie commentedon Feb 27, 2021
@bitingsock Just noticed something, and I think this was also the case previously.
When using subtitles that cannot easily be converted to text (e.g. image based ones), the script doesn't work at all.
I'm not sure what the cause is, but sub-stepping seems to work. You can step from one subtitle to the next. (Of course the match filter can't work without the actual text)
bitingsock commentedon Feb 27, 2021
Correct, it has always only worked on Text bases subs. However, there may be some way to make a way using pure sub-stepping based on properties that are already triggering the functions. I'll have to think about that.
CreamyCookie commentedon Feb 28, 2021
That would be really awesome!
Not sure how useful, but one thing I've tried is to make
speed_transition
get triggered by asub-start
property change (instead ofsub-text
, whose value is then manually requested).However, it seems that with image-based subtitles both
sub-start
andsub-text
only trigger once, and then never again, which might be why it doesn't work.Either I'm missing something, or this is a bug in mpv.
Just found this plugin of yours (which inspired the speed-transition one), and it seems like it would avoid that problem by calling a function periodically (not tried).