I am trying to add second mp3 file(5 second long) over first mp3 file (3 minute long) and it should start after 50 second. if possible it will be great to mix those two mp3 nicely and after that 5 second play first mp3 will keep playing .

i am not stopping first mp3 but mixing second with first mp3 after 30 second.

i tried itoffset but it start at the beginning .

ffmpeg -i 12.mp3 -i 22.mp3 -vsync 2 -filter_complex amerge -ac 2 -c:a libmp3lame -q:a 4 arjun.mp3

ffmpeg -i "concat:12.mp3|22.mp3" -acodec copy arjun.mp3

ffmpeg -i 11.mp3 -i 22.mp3  -filter_complex "[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=mono,atrim=end=20[aud1];[1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=mono,atrim=end=240[bud2];[bud2]adelay=10000[aud2];[aud1][aud2]amix=inputs=2"  amerge -ac 2 -c:a libmp3lame -q:a 4 

ffmpeg -i 75.mp3 -itsoffset -700 -i 22.mp3 -vn -filter_complex amix 0055598.mp3

ffmpeg -i 75.mp3 -itsoffset -700 -i 22.mp3 -vn -filter_complex amix 0055598.mp3

Unfortinately -itsoffset option works only for video streams. Do not use it for audio.

To do your what you are asking for use following command

OFFSET=5 ffmpeg -i in1.mp3 -f lavfi -i aevalsrc=0:d=$OFFSET -i in2.mp3 -filter_complex '[1] [2] concat=v=0:a=1 [a], [0] [a] amix' out.mp3

This will mix in1.mp3 and in2.mp3 into out.mp3 as follows:

    OFFSET seconds    [---------]
  • this gives me error message: "No such filter: '[1]' Error initializing complex filters. Invalid argument" – SZT May 28 '19 at 10:36
  • Which version of FFmpeg do you use? – Anton Leontiev May 28 '19 at 11:58
  • Never mind, I just had to change the single quote with double quote!! Spent almost an hour to figure out what I was doing wrong :( – SZT May 28 '19 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy