Sigmond Kukla
Sigmond Kukla

Reputation: 65

How to combine a video with audio from another video using FFMPEG?

I have two videos of the same length that I'd like to combine. Video A has audio, video B does not. I'd like to take the audio from video A and put it onto Video B. I'd like to do this with FFMPEG, but I can't figure out the arguments I need? Should I use map?

There's a lot of questions about combining a video with audio, but not two videos.

Do I maybe need an intermediate step of converting my original video to audio?

I have tried using this FFMPEG command, and a couple of variations. All of the resulted in just Video A (the one with audio) being the output.

ffmpeg -i videoB.mp4 -i video A.mp4 -c:v copy -c:a aac output.mp4

Upvotes: 3

Views: 6186

Answers (2)

user22425488
user22425488

Reputation: 31

ffmpeg.exe -i "A.mp4" -i "B.mp4" -map 0:a -map 1 -c copy "output.mkv"

Upvotes: 3

kesh
kesh

Reputation: 5463

Try this as a starter

ffmpeg -i videoB.mp4 -i video A.mp4 
  -filter_complex [0:v][1:a][1:v][1:a]concat=n=2:v=1:a=1[vout][aout]
  -map [vout] -map [aout] -c:v h264 -c:a aac output.mp4

You must reencode though.

Upvotes: 2

Related Questions