Skip to content

Instantly share code, notes, and snippets.

@springcoil
Last active May 28, 2021 08:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save springcoil/c403139b571756324f3e0287cd8a2153 to your computer and use it in GitHub Desktop.
audio_download_create_youtube_3.py
def combine_audio(video, speech, audio):
os.system(f'ffmpeg -i {video} -i {speech} -filter_complex "[0:a]volume=0.4[a0]; [1:a]volume=0.9[a1]; [a0][a1]amix=duration=longest[a]" -map 0:v -map "[a]" -c:v copy overlayAudio.mp4')
os.system(f'ffmpeg -i {video} -i {audio} -filter_complex "[0:a]volume=0.0[a0]; [1:a]volume=1.0[a1]; [a0][a1]amix=duration=longest[a]" -map 0:v -map "[a]" -c:v copy substituteAudio.mp4')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment