Skip to content

Instantly share code, notes, and snippets.

@bilashcse
Last active October 18, 2016 09:58
Show Gist options
  • Save bilashcse/38258f714cfa80aa269104d905fe4eb1 to your computer and use it in GitHub Desktop.
Save bilashcse/38258f714cfa80aa269104d905fe4eb1 to your computer and use it in GitHub Desktop.
Add watermark image with NodeJs and ffmpeg
var ffmpeg = require('ffmpeg');
try {
var process = new ffmpeg('mymovie.mp4');
process.then(function (video) {
console.log('Video is ready to be processed');
var watermarkPath = 'watermark.png',
newFilepath = './newVideoFileName.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 Function
video.fnAddWatermark(watermarkPath, newFilepath, settings, callback)
}, function (err) {
console.log('Error: ' + err);
});
} catch (err) {
console.log(err);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment