Using fluent-ffmpeg am trying to merge a set of videos into a single video, which am able to achieve with the following code:
var ffmpeg = require('fluent-ffmpeg'),
command = ffmpeg(),
videoNames = ['video1.mp4', 'video2.mp4', 'video3.mp4'];
videoNames.forEach(function(videoName){
command = command.addInput(videoName);
});
command.mergeToFile('output.mp4')
.on('error', function(err) {
console.log('Error ' + err.message);
})
.on('end', function() {
console.log('Finished!');
});
In additon to the above am trying to overlay an audio to the merged video without removing the existing audio. What am trying to do is replicate the following command line using fluent-ffmpeg wrapper
ffmpeg -i io1.mp4 -i io2.mp4 -i io3.mp4 -i io4.mp4 -i io5.mp4 -i io6.mp4 -i audio.mp3 -filter_complex '[0:a][1:a][2:a][3:a][4:a][5:a]concat=n=7:v=0:a=1,volume=1[aout];[6]volume=0.1[bout];[aout][bout]amerge=[tout];[0:v][1:v][2:v][3:v][4:v][5:v]concat=n=6:v=1:a=0[v1]' -map [v1] -map [tout] -c:a aac -b:a 96K -shortest -y out.mp4
Tried the following but unable to implement the filter_complex with streams properly
var ffmpeg = require('fluent-ffmpeg'),
command = ffmpeg(),
videoNames = ['video1.mp4', 'video2.mp4', 'video3.mp4'];
videoNames.forEach(function(videoName){
command = command.addInput(videoName);
});
command.addInput("myAudio.mp3")
.audioFilters('volume=0.1'); // trying to overlay new audio without removing existing audio
command.mergeToFile('output.mp4')
.on('error', function(err) {
console.log('Error ' + err.message);
})
.on('end', function() {
console.log('Finished!');
});
Which throw the error Error ffmpeg exited with code 1: Cannot find a matching stream for unlabeled input pad 6 on filter Parsed_concat_0
via Dineshkarthik Raveendran
No comments:
Post a Comment