papnkukn / subsrt

Subtitle file converter Node.js library and command line tool.
MIT License
97 stars 35 forks source link

Have a way to specify subtitle format of the input file #5

Open joy2g opened 5 years ago

joy2g commented 5 years ago

I have converted few .srt files to .vtt. But sometime i get the error "Cannot determine subtitle format" while the input file is correctly formatted by .srt.

Is there anyway to make it works? (like help the parser know exactly what kind of input format) Thanks for making this awesome library

dnjstlr555 commented 5 years ago

it was awesome library, but sadly abandoned... there's many bugs on determining subtitle's formats and reformatting those subtitles. however its subtitle formats which used in determine and format are modularized. there's folder named format you might able to adjust them properly.

papnkukn commented 4 years ago

@loveisalie92 sounds like the format cannot be detected automatically due to an unexpected pattern in the .srt file. A sample file is always welcome.

Yes, there is an explicit way to tell the parser which is the input format

var captions = subsrt.parse(content, { format: "srt" });

then the captions can be converted to any other format

var content = subsrt.build(captions, { format: "vtt" });
papnkukn commented 4 years ago

@dnjstlr555 the library has been resurrected, thanks for encouraging :thumbsup: