Hey there.π I just published another NPM package on npmjs.com. The npm package converts the subtitle file (.srt) into a readable and well-standard JSON format.
Check out the NPM link SRT-Convert-JSON
Install
$ npm install srt-convert-json
This package can be used to convert Movies Subtitle to JSON format
Usage
const convert = require('srt-convert-json') convert.process("INPUT_FILE_PATH","OUTPUT_FILE_PATH") // convert.process("./data.srt","./subtitle.json")
For Example, this is an SRT File
1 00:02:38,910 --> 00:02:40,161 English! I'm English! 2 00:05:40,049 --> 00:05:41,801 It's grenadiers, mate.
After converting, the output will be
[ { "position": 1, "start": "00:02:38", "timer1": "910", "end": "00:02:40", "timer2": "161", "text": "English! I'm English!" }, { "position": 2, "start": "00:05:40", "timer1": "049", "end": "00:05:41", "timer2": "801", "text": "It's grenadiers, mate." }, ]
Top comments (5)
Interesting. Can it go the other way around too (from .json to .srt file) ? Maybe that could be useful for people that write subtitles. Also, just an idea, maybe convert it to a cli, so it can be used straight away, instead of first having to import it to a .js file and then running it?
Yeah . Sure I will work on it. Thanks for the idea and appreciation.
Awesome idea! Will check this out soon π
Thank you for the appreciation
Thank you for the appreciation