Skip to content
Advertisement

Concatenate two audios with different duration time

I need to concatenate two audios, but I need to keep the size of the video with the size of the audio “backgroud.wav”. I’m doing like this:

 $code1 = "ffmpeg -y -i voz.wav -i backround.wav -filter_complex amerge -c:a libmp3lame -q:a 4 somnovo2.mp3";


system($code1);

But the result is the size of the audio “voz.wav” which would be 30 seconds. While “background.wav” is 3 minutes long. I need the output to have the time of “background.wav”. How can I do this ?

Advertisement

Answer

Try apad filter before amerge

$code = 'ffmpeg -y -i voz.wav -i background.wav -filter_complex "[0]apad[a];[a][1]amerge[aout]" -map "[aout]" -c:a libmp3lame -q:a 4 output.mp3'

system($code);
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement