I've been trying to add background audio to another audio file. Here is what I tried :
const audio_urls = ['/path/audio1.m4a', '/path/audio2.m4a'];
const file_name = 'merged_file.m4a';
ffmpeg()
.input(audio_urls[0])
.input(audio_urls[1])
.on('end', async function (output) {
console.log(output, 'files have been merged and saved.')
})
.saveToFile(file_name)
For some reason the file generated only has the second audio file sound (i.e. audio2.m4a). Any help is appreciated.