How to convert MKV to MP4 on a Mac
MKV and MP4 are both containers. The video inside an MKV is usually H.264 or HEVC, which MP4 can hold as it is, so most MKV files become MP4 in seconds without re-encoding a frame. The catch is the extras MKV files carry: several audio languages and subtitle tracks, which a careless conversion quietly drops.
Updated
The short version
With FFmpeg installed, this copies the video, every audio track and every text subtitle into an MP4, with no quality loss:
ffmpeg -i input.mkv -map 0:v -map "0:a?" -map "0:s?" -c copy -c:s mov_text -movflags +faststart output.mp4If the video is HEVC, add -tag:v hvc1 before the output name so Apple's apps recognise it. If FFmpeg stops with an error about a codec or subtitles, see the FFmpeg section.
Why an MKV won't open on a Mac
From Apple's support article If a media file doesn't open or play on your Apple device.
Apple's apps work with many media formats, but Apple names .mkv as an example of a file that might need a different app. Finder shows such a file as Matroska Video File
in its Info window (select it and press Command-I). Turning it into an MP4 lets QuickTime Player, Photos, iMovie and most upload forms take it.
Pick a method
- FFmpeg remuxKeeping quality, every audio track and subtitlesFree, Terminal · Run on test filesRun on test files
- HandBrakeOne video at a time in an app, with presetsFree, open source · HandBrake's docsHandBrake's docs
- convtFolders with subfolders, any codec in$39 once · Its FFmpeg arguments runIts FFmpeg arguments run
Renaming an MKV to .mp4 doesn't convert it: the file underneath is still Matroska, so apps that can't read MKV still can't open it.
Convert MKV to MP4 with FFmpeg
Run with FFmpeg 7.0.2 on 8-second MKV files with H.264, HEVC and VP9 video, AAC, AC-3, FLAC and Opus audio, and SRT and ASS subtitles.
FFmpeg is the free command-line tool most video apps are built on. Install it with Homebrew (brew install ffmpeg), then open Terminal in the folder with your MKV.
Why the usual command loses tracks
Most answers online give ffmpeg -i input.mkv -c copy output.mp4. It runs without errors, but FFmpeg only takes one video and one audio track unless you tell it otherwise. Here's what it made from our test files:
- H.264, AAC, SRT subtitles
- Video and audio copied. The subtitle track was left out without a warning.
- HEVC, English and Japanese AC-3
- Only the English track came across. The Japanese one was left out.
- H.264, FLAC
- Copied as is: an MP4 with FLAC audio. If an app plays it without sound, convert the audio to AAC.
- VP9, Opus
- Copied as is: an MP4 with VP9 video and Opus audio. If an app won't open it, re-encode it.
Keep every audio track and subtitle
ffmpeg -i input.mkv -map 0:v -map "0:a?" -map "0:s?" -c copy -c:s mov_text -movflags +faststart output.mp4-map 0:v -map "0:a?"- Takes every video and audio track, not just one. The ? lets a video with no sound through.
-map "0:s?"- Takes every subtitle track, if there are any. The quotes stop the Mac's zsh shell from reading ? as a filename pattern.
-c copy- Copies the video and audio as they are: no quality loss.
-c:s mov_text- Turns SRT or ASS subtitles into MP4's own text subtitles, which MP4 can hold.
-movflags +faststart- Puts the index first, so the MP4 starts playing in a browser before it's fully loaded.
The command maps video, audio and subtitles on purpose, not everything (-map 0). MKV files with styled subtitles often carry their fonts as attachments, and MP4 has nowhere to put them.
What came out of our test
- H.264, AAC, SRT subtitles
- All three tracks kept. The subtitles became MP4 text subtitles (mov_text). 8.6 MB in, 8.6 MB out.
- H.264, AAC, styled ASS subtitles
- All tracks kept, but the subtitles lost their fonts, colors and positions: MP4 text subtitles are plain.
- HEVC, two AC-3 tracks
- Both language tracks kept, with their language tags.
- ASS subtitles plus an attached font
- Worked with the command above. With -map 0 instead, FFmpeg stopped because MP4 can't hold the font file.
Each remux took a fraction of a second, and the MP4s were the same size as the MKVs give or take a few kilobytes.
HEVC: add the hvc1 tag
ffmpeg -i input.mkv -map 0:v -map "0:a?" -map "0:s?" -c copy -c:s mov_text -tag:v hvc1 -movflags +faststart output.mp4FFmpeg copies HEVC video into MP4 with the tag hev1. QuickTime and Apple devices only play HEVC tagged hvc1, so add -tag:v hvc1. Use it only for HEVC: on an H.264 video it would label the stream wrongly.
FLAC, Opus or AC-3 audio: convert just the sound
ffmpeg -i input.mkv -map 0:v -map "0:a?" -map "0:s?" -c:v copy -c:a aac -b:a 192k -c:s mov_text -movflags +faststart output.mp4MP4 can hold FLAC, Opus and AC-3, and FFmpeg copies them without complaint, but plenty of players, editors and upload forms expect AAC. This copies the video untouched and encodes only the audio, which takes seconds.
VP9 or AV1 video: re-encode it
ffmpeg -i input.mkv -map 0:v:0 -map "0:a?" -map "0:s?" -c:v libx264 -crf 20 -preset medium -pix_fmt yuv420p -c:a aac -b:a 192k -c:s mov_text -movflags +faststart output.mp4MKVs saved from the web often hold VP9 or AV1 video. A remux keeps it, and not every player or editor opens that inside an MP4. This makes new H.264 video, which plays almost everywhere. -crf 20 sets the quality: lower looks better and makes bigger files. -map 0:v:0 takes only the first video track, so a cover image some MKVs carry isn't encoded as a second video (FFmpeg reads it as one).
Subtitles that won't convert
Subtitles ripped from a Blu-ray or DVD are pictures, not text, and can't become MP4 text subtitles. FFmpeg then stops with this error:
Subtitle encoding currently only possible from text to text or bitmap to bitmapReplace -map "0:s?" -c:s mov_text with -sn to leave the subtitles out, or keep the MKV for watching with subtitles.
Every MKV in a folder
To remux every MKV in the current folder, whether it ends in .mkv or .MKV, run this in Terminal:
find . -maxdepth 1 -iname "*.mkv" -exec sh -c 'ffmpeg -i "$1" -map 0:v -map "0:a?" -map "0:s?" -c copy -c:s mov_text -movflags +faststart "${1%.*}.mp4"' _ {} \;It skips subfolders. A file whose codecs or subtitles need the fixes above prints an error and gets no MP4, while the loop carries on with the rest, so read the output before you delete anything. For a mixed folder, convt below re-encodes whatever it finds.
Convert MKV to MP4 with HandBrake
From HandBrake's quick start. We haven't run it ourselves.
- Open HandBrake and click Open Source, or drag the MKV onto its window.
- Pick a preset. HandBrake's docs suggest the default Fast 1080p30 as fast and compatible with most devices.
- Check that the format on the Summary tab is MP4, and choose where to save the new video.
- Click Start.
HandBrake is free and open source. It always re-encodes the video, so it takes far longer than a remux and the copy is a new encode, but it fixes any codec in one go. Check its Audio and Subtitles tabs if you need more than one language: a preset decides which tracks it takes.
Convert whole folders with convt
We ran the FFmpeg arguments convt 0.5.0 uses for MP4, taken from its source, with the FFmpeg it ships, on the same test files. The folder command is the one we ran with the 0.5.0 command-line tool for the MOV guide.
convt is a Mac and Windows app that converts files on your computer, with a command-line tool in the same install. It brings its own FFmpeg, so you don't need to install it. Local conversions never upload your videos.
Install it with Homebrew, which puts the convt command in Terminal, or from the download page or GitHub releases.
brew tap opencoredev/convt https://github.com/opencoredev/convtbrew install --cask convtIf you installed from the disk image, type /Applications/convt.app/Contents/MacOS/convt instead of convt. To convert a folder and every folder inside it into a separate mp4 folder:
convt videos --to mp4 -r -o mp4-r includes subfolders and -o mp4 rebuilds the same folders under mp4. Leave out -o and each MP4 is written next to its MKV. convt converts videos one at a time.
convt 0.5.0 always re-encodes to H.264 video and AAC audio, so VP9, HEVC, FLAC and Opus files all come out as MP4s that play everywhere. It's slower than a remux, and it keeps less:
- Video
- H.264 at CRF 20 (the x264 encoder's medium preset), same resolution and length, from every codec we tried.
- Audio
- One track, as AAC at 192 kbit/s: FFmpeg's default pick, the track with the most channels. Our second language track was left out.
- Subtitles
- Left out.
So for a film with several languages or subtitles, use the FFmpeg remux above. For a folder of ordinary videos in mixed codecs, convt does it in one command. To make the MP4s smaller, add --video-height 720, -q 60 or --video-codec hevc; the MOV guide shows what each did to a test clip.
Or right-click in Finder
From convt's own documentation. We haven't clicked through it in Finder for this guide.
Open convt once, then turn on its Finder extension in System Settings › General › Login Items & Extensions › Finder. After that, Control-click your MKV files, choose Convert with convt, then MP4.
Convert MKV to MP4 on Windows
The commands are the ones we ran on Linux, with Windows paths. We haven't run them on Windows.
The single-file FFmpeg commands above work the same in PowerShell. With convt installed, its command-line tool sits in your user folder and isn't on your PATH, so give its full path:
& "$env:LOCALAPPDATA\Programs\convt\convt.exe" Videos --to mp4 -r -o mp4Or open convt from the Start menu, drag the MKV files onto its window and choose MP4. convt's right-click menu in File Explorer isn't part of the Windows installer yet.
Questions
- Does converting MKV to MP4 lose quality?
- Not with a remux: the video and audio are copied, not encoded again, and the file stays about the same size. Re-encoding, which HandBrake and convt do, loses a little, and at sensible settings it's hard to see.
- Why did my subtitles disappear after converting?
- A plain
ffmpeg -i input.mkv -c copy output.mp4leaves them out, and so does convt 0.5.0. Use the command at the top of this page, which maps the video, audio and subtitles. Picture subtitles from discs can't be converted to MP4 text subtitles at all. - Why does my MP4 only have one language?
- FFmpeg picks a single audio track unless you map them yourself with
-map 0:v -map "0:a?". With it, every language track comes across with its language tag, and players that support MP4 audio tracks let you switch between them. - Is MP4 better than MKV?
- Not in quality: it's the same video in a different container. MKV holds more kinds of tracks, such as styled subtitles and fonts. MP4 plays in more places, including Apple's apps, browsers and most upload forms.
- Does convt upload my videos?
- Not for local conversions. The app and the command-line tool convert on your computer. The app uploads a file only if you pick Cloud for a job, which is part of Desktop + Cloud. See every format it handles on the formats page.