I’ve got one video file (let’s say “vid.mp4”) and two audio files (“1.aac” and “2.aac”) as inputs. I need to replace two parts in the original video’s sound track with these two new audios, while retaining the original video track.
The first cutout is at timecode from 0.44 to 1.85 sec. The second is from 15.6 sec to end of video.
I’m doing it like this:
ffmpeg -y -i vid.mp4 -i 1.aac -i 2.aac -filter_complex "[0:a]atrim=end=0.44[a1]; [0:a]atrim=start=1.85:end=15.6; [a1][1:a][a2][2:a]concat=n=4:v=0:a=1[a]" -map 0:v -map "[a]" -c:a aac out.mp4
But the final video only contains the first audio part (a1
). When trying without the video track, the same is true: only the first audio is saved:
ffmpeg -y -i 1.aac -i 2.aac -filter_complex "[0:a]atrim=end=0.44[a1]; [0:a]atrim=start=1.85:end=15.6; [a1][1:a][a2][2:a]concat=n=4:v=0:a=1[a]" -map "[a]" -c:a aac out.aac