Search code examples
pythonpython-3.xffmpegmoviepy

Moviepy : Mix multiple audio files


I want to mix multiple audio files and export single audio file, to demonstrate, here's a example timeline;

audio1 : -----------------------------------------------------------------------

audio2 :      ===============

audio3 :                                   +++++++++++

audio4 :                                                         ************

audio5 :                                                     ~~~~~~~~~

I have the delay times, like, audio2 should be played with 2 seconds delay after audio1 is played and etc. How can I mix these AudioFileClip()?


Solution

  • Use CompositeAudioClip with clip.set_start().

    In a single line, you could do mixed = CompositeAudioClip([audio1, audio2.set_start(2), audio3.set_start(7)]). If you have complicated start times or other effects that you wish to apply, you can of course break it out into more lines.