Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ThorsAngerVaNeT/00e2ce7e7529e11ac18cf952e1839c70 to your computer and use it in GitHub Desktop.

Select an option

Save ThorsAngerVaNeT/00e2ce7e7529e11ac18cf952e1839c70 to your computer and use it in GitHub Desktop.
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Basically just copy video and audio stream as is into a new container, no funny business.

The easiest way to switch MKV to MP4, is to copy the existing video and audio streams and place into a new container. This avoids any encoding and hence no quality will be lost.

Single file conversion example

ffmpeg -i example.mkv -c copy example.mp4

Multiple file conversion (cd into directory containing mkv files and run the following)

If you want to batch convert multiple MKV files, you can switch into the directory and run the following:

Unix one-liner example i.e. MacOS/Linux
for i in *mkv; do ffmpeg -i "$i" -c copy "${i%.mkv}.mp4"; done
Windows one-liner example
for %i IN (*.mkv) DO ffmpeg -i "%i" -c copy "%i.mp4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment