在ffmpeg中将2个音频文件与视频合并

问题描述:

我正在尝试将2个音频文件.WAV与1个视频文件.MP4合并,以使用Windows中的CMD.MP4扩展名生成输出.

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.

这是我尝试过的:

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

CMD的输出是:

此命令将输出Output.MP4文件,但它将仅将视频与1个音频文件(A2.WAV)合并,并忽略其他音频文件A1.WAV

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

现在我想合并而无需重新编码而没有任何偏移,只需合并3个文件,就像它们在文件.MP4文件中一样.

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 * like this and this but they didn't help.

为了混合音频,您应该使用amix过滤器

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