vtt2srt

WebVTT to SRT converter

Usage no npm install needed!

<script type="module">
  import vtt2srt from 'https://cdn.skypack.dev/vtt2srt';
</script>

README

vtt2srt

WebVTT to .srt converter. Sometimes bad internet connection leaves you no option but to download some videos instead of watching them in your browser. But those videos often come with closed captions in WebVTT, and this format is not widely supported in media players yet.

Installation

npm install vtt2srt

bower install vtt2srt

Or download and include vtt2srt.js manually in your page.

Programmatic usage

var fs = require('fs');
var vtt2srt = require('vtt2srt');

var vtt = fs.readFile('captions.vtt', function (err, captionsBuff) {
    if (!err) {
        console.log(vtt2srt(captionsBuff.toString()));
    }
});

Commandline converter

node bin/convert.js < elephants_dream.vtt > elephants_dream.srt