- pysrt
- webvtt-py
pip3 install pysrt webvtt-py
./vtt-to-srt FILE...
The command accepts one or more files as arguments. For each .vtt, a .srt will be generated in the same folder. Any other extension is ignored.
Python 3 script that converts WebVTT files to SubRip.
License: GNU Lesser General Public License v2.1
Hi Leonardo,
I am writing this issue because recently I got one myself about .vtt format isaacbernat/netflix-to-srt#21 . Seeing you have this here, also written in python, I thought you might be interested in porting the code to the one linked above. One reason would be because many people have already bookmarked it and if netflix is apparently using this new format many people would benefit from being able to convert it from the existing repository they already rely on.
Thanks in advance.
Isaac
First of all, thanks for your script. It was the only converter I found on github actually working when there are styles in the input vtt.
but would it be possible to add font style in the output? :)
For example here is an input:
WEBVTT
STYLE
::cue {
font-family: Verdana, Arial, Tiresias;
line-height: 125%;
}
::cue(.white) {
color: #ffffff;
}
::cue(.lime) {
color: #00ff00;
}
::cue(.cyan) {
color: #00ffff;
}
::cue(.red) {
color: #ff0000;
}
::cue(.yellow) {
color: #ffff00;
}
::cue(.magenta) {
color: #ff00ff;
}
::cue(.blue) {
color: #0000ff;
}
::cue(.black) {
color: #000000;
}
::cue(.bg_black) {
background: rgba(0, 0, 0, 0.76);
}
sub0
00:00:07.120 --> 00:00:09.480 line:-1
<c.magenta.bg_black>Musique douce</c>
sub1
00:00:09.720 --> 00:00:29.520 align:left line:-1
<c.magenta.bg_black>---</c>
sub2
00:00:32.439 --> 00:00:35.320 line:-1
<c.magenta.bg_black>Musique douce</c>
sub3
00:00:35.560 --> 00:02:25.240 align:left line:-1
<c.magenta.bg_black>---</c>
sub4
00:02:25.480 --> 00:02:27.440 line:-1
<c.white.bg_black>-Stéphane ? Où on se gare ?</c>
the current output is:
1
00:00:07,120 --> 00:00:09,480
Musique douce
2
00:00:09,720 --> 00:00:29,520
---
3
00:00:32,439 --> 00:00:35,320
Musique douce
4
00:00:35,560 --> 00:02:25,240
---
5
00:02:25,480 --> 00:02:27,440
-Stéphane ? Où on se gare ?
The desired output would be
1
00:00:07,120 --> 00:00:09,480
<font color="#ff00ff">Musique douce</font>
2
00:00:09,720 --> 00:00:29,520
<font color="#ff00ff">---</font>
3
00:00:32,439 --> 00:00:35,320
<font color="#ff00ff">Musique douce</font>
4
00:00:35,560 --> 00:02:25,240
<font color="#ff00ff">---</font>
5
00:02:25,480 --> 00:02:27,440
-Stéphane ? Où on se gare ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.