Skip to content

Instantly share code, notes, and snippets.

@armindocachada
Created July 21, 2020 15:42
Show Gist options
  • Save armindocachada/5d2417ec7d2eda5cbae7e4cb2a9bb314 to your computer and use it in GitHub Desktop.
Save armindocachada/5d2417ec7d2eda5cbae7e4cb2a9bb314 to your computer and use it in GitHub Desktop.
Replaces the audio for a given video file videoFilePath with the audio provided by audioFilePath
def merge_video_with_audio_ffmpeg(videoFilePath,audioFilePath,filePathOutput,start_time_audio="00:00:05"):
subprocess.call(['ffmpeg', '-i', videoFilePath,
'-itsoffset', start_time_audio,
'-i', audioFilePath,
'-c:v', 'copy',
'-map', '0:v:0',
'-map', '1:a:0',
filePathOutput, '-y'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment