Well, first of all, a i have some audio inputs and i want to merge all into a single audio file with acrossfade between them.
file1.mp3, file2.mp3...fileN.mp3
I'm doing a reduce to include all the inputs, like this:
inputs.reduce((result, file) => result.addInput(file), ffmpeg())
And for adding the acrossfade, i created a function that receives my inputs and build the complexFilter. The returned filters looks like this:
[
{
filter: 'acrossfade',
inputs: [ '0', '1' ],
options: { d: 5, overlap: '1', c1: 'nofade', c2: 'nofade' },
outputs: 'a0'
},
{
filter: 'acrossfade',
inputs: [ 'a0', '2' ],
options: { d: 5, overlap: '1', c1: 'nofade', c2: 'nofade' },
outputs: 'a1'
},
{
filter: 'acrossfade',
inputs: [ 'a1', '3' ],
options: { d: 5, overlap: '1', c1: 'nofade', c2: 'nofade' },
outputs: 'a2'
}
]
After generating my filter, i'm applying it to my previous command with complexFilter:
const filter = buildBlockFilter(inputs);
inputs
.reduce((result, { file }) => result.addInput(file), ffmpeg())
.complexFilter(filter)
.mergeToFile(output)
.on('error', (error) => console.log(error));
After running it, the files are being merged correctly, but without any fade between them, any tips about how to fix this?