I am working on a project where I have to add Title on a video by FFmpeg. I have already succeeded in adding a picture on a video. Can anybody help me to add Text(Title) on a video?
Here is my code for adding Image, please suggest the required modification:
try {
var process = new ffmpeg('public/'+req.body.video);
process.then(function (video) {
console.log('The video is ready to be processed');
var watermarkPath = 'public/images/logo.png',
newFilepath = 'public/videos/watermarked/'+name,
settings = {
position : "SC" // 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);
res.send('videos/watermarked/'+name)
}
}
//add watermark
video.fnAddWatermark(watermarkPath, newFilepath, settings, callback)
}, function (err) {
console.log('Error: ' + err);
});
} catch (e) {
console.log(e.code);
console.log(e.msg);
}
command.videoFilters({
filter: 'drawtext',
options: {
fontfile: 'Lucida Grande.ttf',
text: 'THIS IS TEXT',
/* etc. */
}
});