I was about to merge an audio and video file, According to docs, there is a method name "mergedAdd" that is supposed to merge multiple media streams, But it did not work for me. Am I missing something?
new FFmpeg({ source: '/media/myVideo.avi' })
.mergeAdd('/media/myAudio.mp3')
.on('error', function(err) {
console.log('An error occurred: ' + err.message);
})
.on('end', function() {
console.log('Final video created!');
})
Thanks
You'd have to call mergeToFile to start processing. But this is not what you want to use.
mergeAdd and mergeToFile actually have misleading names. They are used to concatenate videos into a single video file.
You should use addInput to add your audio file and then use saveToFile to save the merged output.
Most helpful comment
You'd have to call
mergeToFileto start processing. But this is not what you want to use.mergeAddandmergeToFileactually have misleading names. They are used to concatenate videos into a single video file.You should use
addInputto add your audio file and then usesaveToFileto save the merged output.