-
Notifications
You must be signed in to change notification settings - Fork 16
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
Find overlapping timestamps when sanitizing #6
Comments
this would be a really helpful feature. i just had to do this manually on a 30 min video. has anyone started on it or even scripted a little workaround perhaps? |
i cooked up a basic hack to implement trimming overlapping subtitle times for srt subs
a more elegant option might be to also allow custom respecting of this could also easily be adapted to just reporting/validating rather than actually changing, or left out of i don't know the subed code well at all, so i'm not sure if this is a very good way to do this. |
Thank you for putting in the work. I only glanced at your code, but I don't see
anything fundamentally wrong with it.
I think it should fit in nicely with the existing SRT code. But we now have VTT
support and trimming should work with either format. If you could use only
functions from subed-common.el to implement this, it should mean all formats are
trimmed.
I also think it would be better to provide this functionality as a public
function that is optionally called automatically after opening a file. Some
users may want overlapping subtitles. I know mpv supports this and just displays
them on top of each other.
Instead of the 1 millisecond gap, you could use subed-subtitle-spacing, which is
already used to prevent overlapping while adjusting start/stop time.
|
hi @rndusr, ah so i just edited the above to make it only run if the custom setting is non-nil, and set that as default. santize-overlaps is already interactive, so can just be run by the user. happy to make it run on both formats, that's what i didn't understand v well with yr code. i can have another play soon and if you like i can (try to!) submit a PR. my personal case re 1ms is that while i use subed-subtitle-spacing generally, the gap is not imperative for me, so it makes a kinda sense to left them w no gap unless adjusted. but cd make it an option somehow. |
i can have another play soon and if you like i can (try to!) submit a PR.
I suggest writing tests. That helped me a lot with pinning down all the edge cases.
the gap is not imperative for me, so it makes a kinda sense to left them w no gap unless adjusted. but cd make it an option somehow.
Maybe with a C-u prefix? You could even use a custom gap that way.
|
i took a look and i'm a little confused. did you maybe mean using the functions included in because that variable contains the funs this code needs, it looks like simply reformatting everything using generic functions would work. is that correct? i also added a custom option to use |
You're right, of course, sorry. I haven't really worked on this project for a
long time, and seem to have successfully dispelled the nightmare of abstraction
from my memory.
|
subed should now properly prevent overlapping subtitles while editing, but it
will still load a file with illegal timestamps.
Sanitizing should report:
Subtitles that have a larger start time than their stop time.
Subtitles that have a larger stop time than the next subtitle's start time, if
there is a next subtitle.
Should this be implemented generically for all subtitle formats?
I'm not familiar with any subtitle formats besides SubRip. If all widely used
formats have the same concept of start/stop timestamps per subtitle, these
checks should probably be implemented generically.
The text was updated successfully, but these errors were encountered: