Closed jp1017 closed 5 months ago
Sorry, but github issues is not a support forum. You don't need anything srt specific, just loop over the SRT files with an index and do:
sub[i].end = sub[i+1].start
With bounds checks for i
.
Completely untested, written directly here:
import srt
with open("input.srt", "r") as file:
srt_content = file.read()
subtitles = list(srt.parse(srt_content))
for i in range(len(subtitles) - 1):
subtitles[i].end = subtitles[i + 1].start
modified_srt_content = srt.compose(subtitles)
with open("output.srt", "w") as file:
file.write(modified_srt_content)
I have a requirement:
Here is a srt file.I want to make the sub's endtime equls the next sub's starttime. How to make it.