How to convert mkv to mp4 on macOS



Matroska (mkv) is a file format that contains audio, video, picture, subtitles, etc. This mkv format is not so friendly to the Apple environment. In this simple tutorial for beginners we will explain how to convert multiple files from mkv to mp4 using the command line.

Step 1: Install brew dependencies

If you don't have brew, please follow this instructions to install it.

brew install ffmpeg

Step 2: Command to process multiple mkv files

The next bash line will iterate on all mkv files in the current directory and it will call ffmpeg and convert it to mp4:

for f in *.mkv;do ffmpeg -i "$f" -c:v copy -c:a aac -b:a 256k -strict -2 "${f%mkv}mp4";done