Capítulo 675 de 988
Converts a two-dimensional array of Caption items into a string in the SubRip format (. srt).
const captions: Caption[] = [
{
text: 'Welcome to the Example Subtitle File!',
startMs: 0,
endMs: 2500,
timestampMs: 1250,
confidence: 1,
},
{
text: 'This is a demonstration of SRT subtitles.',
startMs: 3000,
endMs: 6000,
timestampMs: 4500,
confidence: 1,
},
{
text: 'You can use SRT files to add subtitles to your videos.',
startMs: 7000,
endMs: 10500,
timestampMs: 8750,
confidence: 1,
},
];
const lines = captions.map((caption) => [caption]);
const serialized = serializeSrt({lines});
/* serialized = `1
00:00:00,000 --> 00:00:02,500
Welcome to the Example Subtitle File!
2
00:00:03,000 --> 00:00:06,000
This is a demonstration of SRT subtitles.
3
00:00:07,000 --> 00:00:10,500
You can use SRT files to add subtitles to your videos.
`
*/