node-vtt-2-srt
Convert WebVTT subtitle into SubRip SRT format.
Setting up
npm install node-vtt-2-srt# or set it up globally npm install node-vtt-2-srt --global
Command line
You may use it from the terminal if vtt-to-str was installed globally
node-vtt-2-srt example.vtt example.srtcat example.vtt | vtt-to-srt > example.strnode-vtt-2-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