Mousa Alfhaily
Mousa Alfhaily

Reputation: 1290

Merging 2 audios files with a video in ffmpeg

I'm trying to merge 2 audio files (.wav with video file .mp4) to produce the output in video.mp4 extension using ffmpeg on Windows CMD.

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 :

enter image description here

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

I want to merge without re-encoding or any offset, just merging the 3 files as they are in a file one .mp4 file.

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

Upvotes: 5

Views: 5715

Answers (1)

Gyan
Gyan

Reputation: 93369

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

Upvotes: 16

Related Questions