@lordofmax/subtitle-merger
v1.0.7
Published
Takes several .srt files and merge them together
Downloads
26
Maintainers
Readme
Subtitle Merger
Simple module written in Javascript with ECMAScript module format.
Takes several .srt
files as input and concatenate them in one single .srt
file
Input:
- Several
.srt
files along with the duration of the video they represent - A path for the output
.srt
file generated by the module
Output:
- A new
.srt
file containing all input files combined and ordered in the same way they are passed to the module.
Installation
npm install @lordofmax/subtitle-merger
Example
Let's say we have two subtitle files
sub1.srt
1
00:00:41,666 --> 00:00:44,793
I've got the vibes. This thing is evil, man.
2
00:00:44,878 --> 00:00:47,171
I got a bad feeling.
3
00:00:47,297 --> 00:00:48,422
Shut up and keep moving.
sub2.srt
1
00:01:04,320 --> 00:01:05,990
Please.
2
00:01:06,260 --> 00:01:08,060
Please don't hurt me.
Code
import {merge, Subtitle} from '@lordofmax/subtitle-merger'
const sub1 = new Subtitle('sub1.srt', 90000); // The video duration is 90 seconds
const sub2 = new Subtitle('sub2.srt', 90000); // The video duration is 90 seconds
merge('output-sub.srt', sub1, sub2);
Results in
output-sub.srt
1
00:00:41,666 --> 00:00:44,793
I've got the vibes. This thing is evil, man.
2
00:00:44,878 --> 00:00:47,171
I got a bad feeling.
3
00:00:47,297 --> 00:00:48,422
Shut up and keep moving.
4
00:02:34,320 --> 00:02:35,990
Please.
5
00:02:36,260 --> 00:02:38,060
Please don't hurt me.