vtt-to-srt
Convert WebVTT (The Web Video Text Tracks Format, aka html5 video subtitles) into SubRip SRT.
Check it out srt-to-vtt for reverse convertion.
Setting up
npm install vtt-to-srt# or set it up globally npm install vtt-to-srt --global
Command line
You may use it from the terminal if vtt-to-str was installed globally
vtt-to-srt example.vtt example.srtcat example.vtt | vtt-to-srt > example.strvtt-to-srt example.str < example.vtt
Usage
If converting from a text file:
;;fs;
If converting from an string:
;;const vttString = 'WEBVTT FILE\r\n1\r\n00:00:01.000 --> 00:00:02.000\r\nthis is WebVTT';const srtStream = ;srtStream;srtStream;srtStream;
If converting to an string:
;;const vttString = 'WEBVTT FILE\r\n1\r\n00:00:01.000 --> 00:00:02.000\r\nthis is WebVTT';const srtStream = ;srtStream;srtStream
Note: these examples are available in the examples
folder. Run them with babel-node
Test
npm run test