forked from pakforlay/add-watermark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add-wm
33 lines (32 loc) · 1.08 KB
/
add-wm
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
var ffmpeg = require('ffmpeg');
// This code by https://gist.github.com/suissa
try {
var process = new ffmpeg('7246712539050970374.mp4'); // nama file video
process.then(function (video) {
console.log('Memproses penambahan Watermark pada Video');
var watermarkPath = 'wm-white.png', // ganti dengan nama file watermark
newFilepath = './video-com-watermark.mp4',
settings = {
position : "C" // Position: NE NC NW SE SC SW C CE CW
, margin_nord : null // Margin nord
, margin_sud : null // Margin sud
, margin_east : null // Margin east
, margin_west : null // Margin west
};
var callback = function (error, files) {
if(error){
console.log('ERROR: ', error);
}
else{
console.log('Sukses Menambahkan Watermark', files);
}
}
//add watermark
video.fnAddWatermark(watermarkPath, newFilepath, settings, callback)
}, function (err) {
console.log('Error: ' + err);
});
} catch (e) {
console.log(e.code);
console.log(e.msg);
}