So I have a video about 8 minutes long and I got two Creative Commons songs of 5 and 3 minutes. I would like to copy the video and replace video's audio with one song playing and after it the other song playing.

Can I do that in one call? Or do I need to concat the songs to a new audio file, and merge video and audio together in a 2nd call?

I've been trying things like these:

ffmpeg -i video.mp4 -i song1.mp3 -i song2.mp3 -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 -map 1:a:1 output.mp4

ffmpeg -safe 0 -f concat -i list.txt -c:v copy -c:a aac output.mp4

The result is always just the video with the old audio.

1 Answer 1


You can use concat filter:

ffmpeg -i video.mp4 -i song1.mp3 -i song2.mp3 -filter_complex "[1:a][2:a]concat=n=2:v=0:a=1[a]" -map 0:v -map "[a]" -c:v copy -c:a aac output.mp4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .