Skip to content

Instantly share code, notes, and snippets.

@Cygon
Last active August 16, 2020 17:55
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 Cygon/ba694e0426db11c435f259e93bcdfbcd to your computer and use it in GitHub Desktop.
Save Cygon/ba694e0426db11c435f259e93bcdfbcd to your computer and use it in GitHub Desktop.
Turning `.mkv` into `.mp4` without transcoding

Turning .mkv into .mp4 without transcoding

Obviously, don't do this unless you have a pressing reason. Matroska (.mkv) is the better and free-er format and this only works if the video was in an .mp4 supporting format from the start (i.e. H.264 / H.265 with AC3 / AAC).

Requires mkvtoolnix (for mkvextract) and gpac (for MP4Box)

Step 1 - Unbox the Matroska Container

mkvextract tracks MyH264Video.mkv 0:video.h264 1:audio.ac3

Step 2 - Re-box as MP4 Container

MP4Box -add video.h264#video -add audio.ac3 -new MyMP4Video.mp4

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