How to mix two audio files with ffmpeg amerge filter
I have two audio files and I want merge them into one with volume and delay filter. I need insert delay in one audio stream, also change volumes. I have problem with understanding map
option...
ffmpeg -i one.mp3 -i two.mp3 -shortest -filter_complex \
"[0:a]volume=0.4[a0]; \
[1:a]volume=5.0[a1]; \
[0:a]adelay=10000[0:a]; \
[0:a][1:a]amerge=inputs=2[out]" \
#wrong
-map [a0] -map [a1] -map ["out"] -ac 2 -c:a libfdk_aac output.m4a
How to do this correctly?
Solution 1:
Assuming you intend to delay the entire first input by 10000 milliseconds,
ffmpeg -i one.mp3 -i two.mp3 -shortest -filter_complex \
"[0:a]adelay=10000|10000,volume=0.4[a0]; \
[1:a]volume=5.0[a1]; \
[a0][a1]amix=inputs=2[out]" \
-map "[out]" -ac 2 -c:a libfdk_aac output.m4a
(Remember not to include any whitespace after the slash at end of line.)