forked from h2non/videoshow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
captions.js
62 lines (58 loc) · 1.4 KB
/
captions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
var videoshow = require('../')
var audio = __dirname + '/../test/fixtures/song.mp3'
var options = {
loop: 5,
captionDelay: 350,
transition: true,
useSubRipSubtitles: false, // Use ASS/SSA subtitles instead
subtitleStyle: {
Fontname: 'Verdana',
Fontsize: '26',
PrimaryColour: '11861244',
SecondaryColour: '11861244',
TertiaryColour: '11861244',
BackColour: '-2147483640',
Bold: '2',
Italic: '0',
BorderStyle: '2',
Outline: '2',
Shadow: '3',
Alignment: '1', // left, middle, right
MarginL: '40',
MarginR: '60',
MarginV: '40'
}
}
var images = [
{
path: __dirname + '/../test/fixtures/step_1.png',
caption: 'This is a sample subtitle'
}, {
path: __dirname + '/../test/fixtures/step_2.png',
caption: 'Another sample text',
loop: 5
}, {
path: __dirname + '/../test/fixtures/step_3.png',
caption: 'Fast caption',
captionStart: 2,
captionEnd: 3
}, {
path: __dirname + '/../test/fixtures/step_4.png',
loop: 3
}, {
path: __dirname + '/../test/fixtures/step_5.png',
caption: 'Bye bye'
}
]
videoshow(images, options)
.audio(audio)
.save('video.mp4')
.on('start', function (command) {
console.log('ffmpeg process started:', command)
})
.on('error', function (err) {
console.error('Error:', err)
})
.on('end', function (output) {
console.log('Video created in:', output)
})