subtitling
v1.0.1
Published
A subtitle parser
Downloads
87
Maintainers
Readme
Subtitling
A subtitle parser written in TypeScript
# yarn
yarn add subtitling
# npm
npm i --save subtitling
Subrip
import fs from 'fs'
import { Subrip } from 'subtitling'
const file = fs.readFileSync('path/to/subtitle.srt')
const subtitle = new Subrip(file)
console.log(subtitle.getFirstCue())
Output
SubripCue {
cue: {
id: 1,
time: {
startTime: '00:00:23,046',
endTime: '00:00:27,546',
startTimeMS: 23046,
endTimeMS: 27546
},
text: [ 'This is the first line.', 'This is the second line.' ]
}
}
There are methods for cues, like: getCPS()
, getDuration()
and many others.
Supported formats
- [x] Subrip (.srt)
- [ ] WebVTT (.vtt)