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

Cannot understand how to modify srt #3

Open
defencedog opened this issue Sep 7, 2022 · 1 comment
Open

Cannot understand how to modify srt #3

defencedog opened this issue Sep 7, 2022 · 1 comment

Comments

@defencedog
Copy link

Plz developer explain what do you mean by

You must punctuate the subtitle by yourself beforehand, it's not easy to do it automatically.

@nlpsuge
Copy link
Owner

nlpsuge commented Oct 31, 2022

Really sorry for the delay.

For example, there is a youtube video What is Ukraine is getting right? - BBC New and you download both video and the subtitle which is auto-generated.

And the subtitle is auto-generated, so there is no punctuation like ,, ., !, ? in it, and there is no way to cut a video to clips without punctuation for this tool. So you have to add them (punctuation like ,, ., !, ?) to the subtitle by yourself before using this tool to cut videos.

Beside, you have to add ., !, ? to the end of a sentence and modify the timeline accordingly.

Original subtitle:

68
00:02:31,200 --> 00:02:33,280
russian military doctrine says if you

69
00:02:33,280 --> 00:02:35,599
can't advance into a city you pummel it

70
00:02:35,599 --> 00:02:36,959
with artillery

71
00:02:36,959 --> 00:02:38,720
that's what's happened to mariopol and

72
00:02:38,720 --> 00:02:41,920
other cities at huge humanitarian cost

73
00:02:41,920 --> 00:02:44,160
but russia too has had thousands killed

74
00:02:44,160 --> 00:02:45,200
so far

75
00:02:45,200 --> 00:02:47,519
what the west fears now is that to break

76
00:02:47,519 --> 00:02:49,599
this stalemate the kremlin will resort

77
00:02:49,599 --> 00:02:52,080
to something as drastic as chemical or

78
00:02:52,080 --> 00:02:54,319
battlefield nuclear weapons to tip the

79
00:02:54,319 --> 00:03:00,040
odds in its favor frank gardner bbc news

punctuated subtitle:

68
00:02:31,200 --> 00:02:33,280
russian military doctrine says if you

69
00:02:33,280 --> 00:02:35,599
can't advance into a city you pummel it

70
00:02:35,599 --> 00:02:36,959
with artillery. (note: . is added)

71
00:02:36,959 --> 00:02:38,720
that's what's happened to mariopol and

72
00:02:38,720 --> 00:02:41,920
other cities at huge humanitarian cost

73
00:02:41,920 --> 00:02:44,160
but russia too has had thousands killed

74
00:02:44,160 --> 00:02:47,519
so far. (note: . is added) what the west fears now is that to break

76
00:02:47,519 --> 00:02:49,599
this stalemate the kremlin will resort

77
00:02:49,599 --> 00:02:52,080
to something as drastic as chemical or

78
00:02:52,080 --> 00:02:54,319
battlefield nuclear weapons to tip the

79
00:02:54,319 --> 00:02:56,050 (note: the right millisecond is modified accordingly)
odds in its favor. (note: . is added)

It generates two video clips and two subtitle texts according to the video and punctuated subtitle: 68-70, 71-79.

relevant code:

def sentence_not_completed(self, info, next_info):
info_sentences = info.sentences
if str.endswith(info_sentences, '...') and \
(next_info is not None and str.startswith(next_info.sentences, '...')):
return True
if not (str.endswith(info_sentences, '."') or
str.endswith(info_sentences, '.') or
str.endswith(info_sentences, '!"') or
str.endswith(info_sentences, '!') or
str.endswith(info_sentences, '?"') or
str.endswith(info_sentences, '?')):
return True
return False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@defencedog @nlpsuge and others