Skip to content

Instantly share code, notes, and snippets.

@apwan
Last active October 31, 2018 16:54
Show Gist options
  • Save apwan/1454d262bf8632ca50555ab5243922bd to your computer and use it in GitHub Desktop.
Save apwan/1454d262bf8632ca50555ab5243922bd to your computer and use it in GitHub Desktop.
merge audio and video file in ffmpeg
# source: https://superuser.com/questions/277642/how-to-merge-audio-and-video-file-in-ffmpeg
# merge with audio re-encoding
ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a aac -strict experimental output.mp4
# merge without audio re-encoding
ffmpeg -i video.mp4 -i audio.wav -c copy output.mkv
# replace 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
# concat
ffmpeg -i "concat:input1.mp4|input2.mp4|input3.mp4" -c copy output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment