3

I am trying to create an audio file which will have a base audio and multiple other audios over it. And also when the overlayed audio plays, the background audio should be mute or in lower volume.

For eg: There is a song A.mp3. Over this song, i want to add multiple other audios (1.mp3, 2.mp3, 3.mp3 ......) at a particular time period. Let say, 1.mp3 plays at 5th sec to 8th sec, 2 .mp3 plays at 10th sec to 12th sec and so on. Also this should be added as an overlay such that, background sound will always be playing and when the overlayed audio plays, the background audio should be muted or slowed in volume.

I tried with ffmeg library but haven't found any solution yet.

Suhaib Janjua
  • 3,538
  • 16
  • 59
  • 73
  • 2
    Read what is expect of you: [mcve] – Nick Cardoso Feb 24 '17 at 07:26
  • Follow the answer [here](http://superuser.com/a/1092346/114058) to mix all the overlaid audios. Then feed that as the reference and the BG audio as the first input to the [sidechaincompress](https://ffmpeg.org/ffmpeg-filters.html#sidechaincompress) filter. Use amix to mix the processed BG audio with the combined overlaid track. – Gyan Feb 24 '17 at 11:12
  • @Mulvya thanks for the reply. i am still unable to lower the audio of bg audio when overlaid audio plays. can you provide a way to lower the audio at particular interval of time? – Vivek Bhatt Feb 25 '17 at 15:03
  • Run the command with `-report` added and upload the report. – Gyan Feb 25 '17 at 15:22
  • @Mulvya i managed to run that command. thanks again. i have another scenario now. i want to add a bg audio to a video and at certain period of time i want to lower the volume of bg audio. Any suggestion for it? – Vivek Bhatt Feb 25 '17 at 17:25
  • Use volume filter: `volume=0.5:enable='between(t,323,431)'` – Gyan Feb 25 '17 at 18:03
  • @Mulvya how can i use it mulitple places? say 5 to 10, 10 to 20 and so on.. – Vivek Bhatt Feb 25 '17 at 18:16
  • `volume=0.5:enable='between(t,323,431)+between(t,511,531)+...'` – Gyan Feb 25 '17 at 18:18
  • @Mulvya thanks again.. just one last thing. how can i do both the task in single command? I mean i want to merge the video with the bg audio and also control the volume of bg audio in single command. and also the output will be of same as length of video. – Vivek Bhatt Feb 25 '17 at 19:08
  • Show your full command. – Gyan Feb 25 '17 at 19:14
  • @Mulvya ffmpeg -i video.mp4 -i bgaudio.mp3 -filter_complex volume=0.1:enable='between(t,0,2)+between(t,5,8)' output.mp4 – Vivek Bhatt Feb 25 '17 at 19:23
  • Do you want to keep the video's audio? – Gyan Feb 25 '17 at 19:32
  • yes i want to. thats priority. but not whole video will have audio. so at places where the video doesn't have audio, i want to play bg audio at full volume and places where the video has audio, i want to lower the bg audio volume. is it possible for you to drop me ur mail id? – Vivek Bhatt Feb 25 '17 at 19:35

0 Answers0