I wanna merge two videos into one showing one on the left side and another on the right, not concatenation. Below code works almost fine, but both two audio lost. how can i do this without losing sound?
ffmpeg()
.input('video1.mp4')
.input('video2.mp4')
.videoCodec('libx264')
.complexFilter([
'[0:v]scale=400:300[0scaled]',
'[1:v]scale=400:300[1scaled]',
'[0scaled]pad=800:300[0padded]',
'[0padded][1scaled]overlay=shortest=1:x=400[output]',
])
.outputOptions(['-map [output]'])
.output('output.mp4')
.on('error', function (er) {
console.log('error occured: ' + er.message);
})
.on('end', function () {
console.log('success');
})
.run();