Git Product home page Git Product logo

srt-to-vtt's Introduction

srt-to-vtt

Transform stream that converts srt files to vtt files. vtt files are used to provide subtitles in html5 video

npm install srt-to-vtt

build status

Usage

var srt2vtt = require('srt-to-vtt')
var fs = require('fs')

fs.createReadStream('some-subtitle-file.srt')
  .pipe(srt2vtt())
  .pipe(fs.createWriteStream('some-html5-video-subtitle.vtt'))

Command line usage

There is also a command line tool available

npm install -g srt-to-vtt
srt-to-vtt --help

License

MIT

srt-to-vtt's People

Contributors

amilajack avatar brandly avatar chocobozzz avatar grunjol avatar mafintosh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

srt-to-vtt's Issues

Move keyword not stripped

Hi,

thanks for this package.

however, move and probably other keywords in srt should be removed when converting to vtt.

example:

0
00:00:03,000 --> 00:00:10,500
{\move(10,10,190,230,100,400)\fad(0,1000)\fscx25\fscy25\t(0,6000,\fscx125\fscy125)\c&H000000&\3c&H00FFFF&}First Line

should be converted to

WEBVTT

1
00:00:03.000 --> 00:00:10.500
First Line

Regards
Omar M.

VTT file with empty content.

Hello sir, I used this package to convert this SRT file (please check attachment), but it returns a VTT file with blank content. It worked with the other SRT files I have, but not working with this one. Thanks in advance if there's any solution or workaround to fix it.

FYI, I use the tool called SubtitleEdit to create this SRT file.
That Girl - YouTube.en.srt.zip

Adding binaries for easier intergration in projects

I was developing an application in Python, and I needed to use srt-to-vtt, I installed it and it worked just fine. The problem was that distributing my app was impossible, as the users would have to install node, npm and srt-to-vtt separately. So I packaged bin.js into executables for all major platforms, and used them instead. Could you add them to your 1.1.1 release, to help any others that might need this? I have uploaded them in that release inside my fork. Thanks!

send data to Blob?

How to do this ?

 const stream = new Readable();
                    stream._read = () => {};
                    stream.push(data);
                    stream.on("finish", chunk => {

                        url = window.URL.createObjectURL(new Blob([chunk], {type: 'text/vtt'}));

                    });
                    stream.pipe(srt2vtt());

Missing ending line

When the last caption line does not have an empty line the entire caption is missing.

Check test file in #3

if the last lines ends in single 0A the entire line is skipped, but if its 0A 0A its converted

Detect input (.srt) file encoding

.srt files come from different sources, and there is no rule (or declaration) on character encoding, so its very common to find latin1(iso-8859-1 / cp1252) encoded files.

But vtt MUST BE UTF-8 encoded.

When input file (using CLI) is a latin1 the output file is not correctly encoded

tests.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.