Skip to content

Instantly share code, notes, and snippets.

@stungeye
Created January 21, 2015 19:54
Show Gist options
  • Select an option

  • Save stungeye/9d23b7507252705f356c to your computer and use it in GitHub Desktop.

Select an option

Save stungeye/9d23b7507252705f356c to your computer and use it in GitHub Desktop.
MUX MP4 Audio and Video Together

The second file can be an mp4 instead of an mp3:

ffmpeg -i input.mp4 -i input.mp3 -c copy -map 0:0 -map 1:0 output.mp4

To concat to mp4s:

ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment