How can I convert *.vtt subtitles to *.srt subtitles using regex (regular expressions) in notepad++?
I've managed to do it myself:
Find what: (\d)\.(\d)
Replace with: \1,\2
This replaces every instances like 6.9
and 2.0
by 6,9
and 2,0
in the .vtt file.
Save the changes to the file, and change the file extension to .srt
, of course.
Now this will do, but if you fear that there might be a X.Y
in the text that you wouldn't want to change to X,Y
you should do as the following:
Find what: (\d\d:\d\d:\d\d).(\d\d\d) --> (\d\d:\d\d:\d\d).(\d\d\d)
Replace with: \1,\2 --> \3,\4
Related videos on Youtube
Comments
-
goofle almost 2 years
As I learned, every line in a .vtt file starts with something like this:
00:00:06.984 --> 00:00:12.020
(line.1)But it should be like this for a .srt file:
00:00:06,984 --> 00:00:12,020
(line.2)(in case you didn't see it,
.
turned into,
)How can I achieve this (replacing line.1 with line.2) using regex in notepad++?
By using
\d\.\d
I can find every instances like6.9
and2.0
but I don't know how to change them to6,9
and2,0
.-
abhishekkannojia over 8 yearsIf you have found a solution to your problem, please post it as an answer for future users. You can always answer your own questions.
-
goofle over 8 years@abhishekkannojia I knew I could but thought maybe that's frowned upon or whatever they say.. I did answer my question. Thanks.
-
n611x007 over 7 years@Eternal_ink anyone ever wants to stop you just keep doing what you believe to be good and nice, all the more. especially if they were people at random. thanks for posting!
-
n611x007 over 7 years@Eternal_ink also one shouldn't care less about people "frowning". They can always go home and frown at the mirror.
-
-
Dean almost 3 yearsI used the above directions as I needed to import a VTT file into Premiere Pro and it only supports SRT files. The above directions worked and got me there but Premiere rejected the srt file because it was missing the numbering above each caption. I was able to use regex and replace \n\n with \n\n1\n to put a number one above each caption line and then I used the Visual Studio Code plugin "Subtitles Editor" to renumber them. Hope this helps someone.