我正在開發一個項目,我必須通過FFmpeg在視頻上添加標題。我已經成功地在視頻上添加了一張圖片。任何人都可以幫助我在視頻中添加文字(標題)嗎?如何在節點JS上通過ffmpeg在視頻中添加標題
這裏是我的添加圖片代碼,請建議所需的修改:
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);
}
@ md-nazmul-hossain-bilash在問題中等同於'command'的是什麼? '過程'也許? – veich
@veich哪個等價命令? –
@ md-nazmul-hossain-bilash我的意思是'command.videoFilters'中的'command'是什麼? – veich