How to add mp3 inbetween mp3 with ffmpeg - concatenation inbetween

I've 2 mp3 files. a.mp3 is 1000 seconds long and b.mp3 is 10 seconds long. I'd like to add b.mp3 to a.mp3 starting from 50s seconds, so the output will be 1010 seconds long.

How can I achieve it with FFmpeg? Is there any simple command-line way for that?

This seems to be an easy task, but I didn't find any solution on google.


Solution 1:

atrim

ffmpeg -i "a.mp3" -i "b.mp3" -filter_complex "
[0:a]atrim=end=50,asetpts=PTS-STARTPTS[a1];
[0:a]atrim=start=50,asetpts=PTS-STARTPTS[a3];
[a1][1:a][a3]concat=n=3:v=0:a=1
" out.mp3