Skip to content

Instantly share code, notes, and snippets.

@sebacruz
Created February 23, 2019 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebacruz/b308ff4494786f63f4efd3c3ed66a752 to your computer and use it in GitHub Desktop.
Save sebacruz/b308ff4494786f63f4efd3c3ed66a752 to your computer and use it in GitHub Desktop.
Merge audio and video with `ffmpeg`

Merge audio and video with ffmpeg

Merging video and audio, with audio re-encoding

$ ffmpeg -i video.mp4 -i audio.wav \
  -c:v copy -c:a aac -strict experimental output.mp4

Copying the audio without re-encoding

$ ffmpeg -i video.mp4 -i audio.wav -c copy output.mkv

Replacing audio stream

$ ffmpeg -i video.mp4 -i audio.wav \
  -c:v copy -c:a aac -strict experimental \
  -map 0:v:0 -map 1:a:0 output.mp4

Source: https://superuser.com/a/277667

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment