-
-
Save ochui/ee0279f63593d2bf270aec3595bb912f to your computer and use it in GitHub Desktop.
Add watermark with Node.js and ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ffmpeg = require('ffmpeg'); | |
try { | |
var process = new ffmpeg('example.mp4'); | |
process.then(function (video) { | |
console.log('The video is ready to be processed'); | |
var watermarkPath = 'watermark-suissa.png', | |
newFilepath = './video-com-watermark.mp4', | |
settings = { | |
position : "SE" // 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('TERMINOU', 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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment