Merging 2 audios files with a video in ffmpeg

2019-06-03 16:13发布

问题:

I'm trying to merge 2 audio file .WAV with 1 video file .MP4 to produce the output in .MP4 extension using CMD in Windows.

This is what i have tried :

ffmpeg -i V.MP4 -i A1.WAV -i A2.WAV -map 0:v -map 1:a -map 2:a -c:v copy -vcodec copy Output.MP4

The CMD output for that is :

This command will output the Output.MP4 file but it will merge the video with only 1 of the audio files which is A2.WAV and ignores the other audio file A1.WAV

Now i want to merge without re-encoding without any offset, just merge the 3 files like they are in a file .MP4 file.

I checked some topics here in stackoverflow like this and this but they didn't help.

回答1:

In order to mixdown the audio, you should use the amix filter

ffmpeg -i V.MP4 -i A1.WAV -i A2.WAV -filter_complex "[1][2]amix=inputs=2[a]" -map 0:v -map "[a]" -c:v copy Output.MP4