0

This is the question that was closest to my problem: Ffmpeg add new audio in video (mixing 2 audio)

I need to insert audio from 2nd input file too but WITHOUT cutting first audio stream. I need them to actually overlap in this short fragment.

<1.aac playing>, <1.aac + 2.aac MIX>, <1.aac playing>

Tried to apply -itstimeoffset but it doesnt give desired effect. Though it doesnt fail error-wise, the problem is with output. Said command will provide me with a file where both inputs are combined in a sequential way WITHOUT required delay. For example, im combining 1.aac and 2.aac. The result will be: <2.aac playing>. <1.aac playing> (it somehow swaps 1 and 2 places, prob because of - longest operator i used but this is off-topic).

While i need: <1.aac playing>, <1.aac + 2.aac both playing>, <1.aac playing> with timed funcionality

This command ffmpeg -i 1.mpg -i 2.aac -filter_complex "[0:a]atrim=end=13.90,asetpts=PTS-STARTPTS[aud1]; [1:a]atrim=0:1.30,asetpts=PTS-STARTPTS[aud2]; [0:a]atrim=start=13.90,asetpts=PTS-STARTPTS[aud3]; [aud1][aud2][aud3]concat=n=3:v=0:a=1[aout]" -map 0:v -map "[aout]" -c:v copy -c:a libvo_aacenc output.mp4 achieves TIMING i need, but it makes only 2nd input to play sound in an inserted period. While i need both of them playing.

  • Hi Stey, welcome to Super User. You say the command fails- in what way does it fail? If it fails with an error message, please post the output from ffmpeg; if there is no error but it does not do what is intended, please describe the output. Thanks! – bertieb Aug 1 '15 at 12:09
  • Thank you for your post. It doesnt fail error-wise, the problem is with output. Said command will provide me with a file where both inputs are combined in a sequential way WITHOUT required delay. For example, im combining 1.aac and 2.aac. The result will be: <2.aac playing>. <1.aac playing> (it somehow swaps 1 and 2 places, prob because of - longest operator). While i need: <1.aac playing>, <1.aac + 2.aac both playing>, <1.aac playing> with timed funcionality. – Stey Aug 1 '15 at 12:35
  • @bertieb Another guy recommended this command: ffmpeg -i 1.aac -i 2.aac -lavfi '[1:0]asetpts=PTS+13.90/TB,[0:0]amix' out.mp3 . I tried it but got Error message: [AVFilterGraph @ 0000000003185e00] No such filter: '[1:0]asetpts=PTS+13.90/TB,[0 :0]amix Error initializing complex filters. Invalid argument . I'm using standard Win static build, its either i dont have filter to support his variant of command or it has syntax errors. Anyway this one didnt work too... – Stey Aug 1 '15 at 13:01
  • Ah, the problem is with the files not overlapping when they should (like a crossfade without the fade). It might be of help to edit your original question to include the info from your comments :) – bertieb Aug 1 '15 at 13:10

Your Answer

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

Browse other questions tagged or ask your own question.