Repository navigation
Add support for labels in the SubRip and WebVTT formats - #6139
Conversation
(without actually implementing any new ones in this commit)
LWinterberg
left a comment
There was a problem hiding this comment.
This looks good to me overall. There's some more improvements which may be something for the future. As-is, it adds a valuable feature with the label export in a pretty straight-forward manner, which in my book is good for a merge..
| { | ||
| #ifdef EXPERIMENTAL_SUBRIP_LABEL_FORMATS | ||
| if (format == LabelFormat::WEBVTT) { | ||
| ::AudacityMessageBox( XO("Importing WebVTT files is not currently supported.") ); |
There was a problem hiding this comment.
This would be something to improve in a followup PR. I see that webVTT does some fancy stuff, so the importer would need to be told to strip away everything that we can't deal with, eg.
WEBVTT
STYLE
::cue {
background-image: linear-gradient(to bottom, dimgray, lightgray);
color: papayawhip;
}
00:00:00.000 --> 00:00:04.000 position:10%,line-left align:left size:35%
Where did <b>he</b> go?
would need to be converted to
00:00:00.000 --> 00:00:04.000
Where did <b>he</b> go?
and from there converted to a label.
The tags (<b>, <c>, <i>, <u>, etc) inside the text can stay as they may be things you'd want to set or edit in label form, too - for example to add emphasis to certain words when a character does so too. The style would need to be discarded for the time being.
A second followup would be to make a new exporter for the labels in a similar vein to the Export Audio exporter, which then could have custom fields for styles and such in case of vtt.
| // Parsing data of the form 'HH:MM:SS,sss --> HH:MM:SS,sss' | ||
| // Assume that the line is in exactly that format, with no extra whitespace | ||
| // and less than 24 hours. | ||
| if (timestamp.length() != 29) |
There was a problem hiding this comment.
While I have never seen a vtt or srt file do anything other than this, I'm a bit uncomfortable with such an assumption. I'd prefer something more robust here. This would also make parsing WebVTT easier.
Resolves: #5924
This is a rebase of #394 . The original author is @Pokechu22 and the entirety of this code change should be credited as such.
Recommended: