Yusuf Adeyemo
Yusuf Adeyemo

Reputation: 399

Add underlay audio to and audio at a specific time

Good day, I'm wonder if there is a way to add an audio as an underlay to another audio with FFmpeg at a specific time, more like a podcast advert sounds while the podcast is going on. Here is what I've tried so far

ffmpeg -i audio.mp3 -i background.mp3 -filter_complex "[0:a]volume=1dB[a0];[1:a]volume=0.5[a1];[a0][a1]amerge=inputs=2[a]" -map "[a]" -ac 1 -ab 32000 -ar 22050 -strict -2 -y 10 audio_with_backgroud.mp3

Thank you in advance

Upvotes: 0

Views: 73

Answers (1)

Gokul Nair
Gokul Nair

Reputation: 13

Please try the following:

ffmpeg -i main_audio.m4a -i bgm.mp3 -filter_complex \
[0:0]volume=3.15[a];[1:0]volume=0.07[b];[a][b]amix=inputs=2:duration=longest\
-c:a libmp3lame merged_audio.mp3

Here you can specify how loud the main audio should be (adjust the value of volume = x[a] in the code). the Background score volume can be adjusted using controlling the value of (volume=x[b]).

Upvotes: 1

Related Questions