How to Convert MKV to MP4 with FFmpeg — Remux, Re-encode, and Common Pitfalls
FFmpeg is the Swiss Army knife of video processing — and the most powerful way to convert MKV to MP4 from the command line. It can remux in seconds (lossless, no quality loss) or re-encode with fine-grained control over every codec parameter. This guide covers the exact commands for both approaches, explains common errors, and shows when you can skip the terminal entirely.
Option 1: Remux — MKV to MP4 without re-encoding
If your MKV already contains H.264 or H.265 video with AAC, AC3, or MP3 audio — which most do — you don't need to re-encode anything. The video and audio streams are already MP4-compatible; they just need to be moved from the MKV container to an MP4 container. This is called a remux.
ffmpeg -i input.mkv -c copy output.mp4The -c copy flag tells FFmpeg to copy every stream without touching the encoded data. A 4 GB file finishes in seconds because FFmpeg only reads and rewrites container metadata — it never decodes a single frame.
This is the same operation that our browser-based MKV to MP4 converter performs — but FFmpeg does it from the terminal while the browser tool does it with drag-and-drop.
Option 2: Re-encode — when you need to change codecs
If the MKV contains codecs that MP4 doesn't support (VP9 video, Vorbis audio, FLAC audio), or you want to reduce file size, you need to re-encode. Here are the most common commands:
Re-encode video and audio to H.264 + AAC
ffmpeg -i input.mkv -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 192k output.mp4-crf 23 is the quality dial — lower values mean higher quality and bigger files. 18 is visually lossless, 23 is the default (good quality), and 28+ gets noticeably softer. The -preset controls speed vs compression efficiency: ultrafast is quick but bloated, slow is smaller but takes much longer.
Copy video, re-encode only audio
ffmpeg -i input.mkv -c:v copy -c:a aac -b:a 192k output.mp4Useful when the video is already H.264/H.265 but the audio is in a format MP4 doesn't like (Vorbis, DTS, FLAC). The video is copied losslessly; only the audio is re-encoded.
Re-encode to H.265 (HEVC) for smaller files
ffmpeg -i input.mkv -c:v libx265 -crf 28 -tag:v hvc1 -c:a aac -b:a 192k output.mp4H.265 delivers the same quality as H.264 at roughly half the file size, but encoding is significantly slower. The -tag:v hvc1 flag is critical — without it, Apple devices (iPhone, iPad, Mac) refuse to play the file.
Handling subtitles
MKV commonly contains SRT or ASS text subtitles. MP4 supports text subtitles too, but in its own format called mov_text. To include them:
ffmpeg -i input.mkv -c:v copy -c:a copy -c:s mov_text output.mp4If the MKV has bitmap-based subtitles (PGS from Blu-rays, VobSub from DVDs), MP4 cannot carry them. FFmpeg will error with “codec not currently supported in container.” Your options: burn them into the video with a filter, extract them separately, or drop them with -sn.
Common FFmpeg errors and fixes
“Could not find tag for codec”
The MKV contains a stream whose codec isn't allowed in MP4. Typical offenders: VP9 video, Vorbis audio, PGS/VobSub subtitles. Fix: re-encode the offending stream or drop it. For example, to re-encode Vorbis audio to AAC while copying everything else:
ffmpeg -i input.mkv -c:v copy -c:a aac -c:s mov_text output.mp4“Discarding timestamp” warnings
Usually harmless — MKV allows timestamp gaps that MP4 doesn't. If the output plays fine, ignore these. If you get sync issues, add -avoid_negative_ts make_zero before the output filename.
Output file is much larger than expected
This happens when you forget -c copy — FFmpeg defaults to re-encoding with its built-in codecs, which can produce larger files at lower quality. Always specify your codec settings explicitly. If you just want the same streams in an MP4 container, -c copy is what you want.
FFmpeg CLI vs. browser-based remux
| FFmpeg (command line) | Browser remux (this site) | |
|---|---|---|
| Interface | Command line — requires terminal knowledge | Drag-and-drop in browser — no commands needed |
| Install | Manual download + PATH setup on most systems | None — opens in any modern browser |
| Remux speed | Seconds (reads/writes at disk speed) | Seconds (reads/writes via browser APIs) |
| Codec error handling | Fails with error message — you fix the command | Automatically handles compatible streams |
| Batch support | Yes — via shell scripting | Yes — drop up to 20 files at once |
| Subtitle handling | Manual flags for each stream (-c:s mov_text) | Text subs converted to MP4 format automatically |
| Best for | Power users who want full control over every stream | Anyone who wants MKV→MP4 done in seconds |
When to use FFmpeg vs. simpler tools
FFmpeg gives you total control. If you need to extract specific audio tracks, burn in subtitles, crop or scale video, change frame rates, or chain complex filters — nothing else comes close. It's the right tool when you know exactly what you want and are comfortable in the terminal.
But for the most common case — “I have an MKV that won't play on my phone/TV/editor and I just need it as MP4” — FFmpeg is overkill. You're typing a command to do what -c copy does: move streams from one container to another. A browser-based MKV to MP4 remux does the same thing with zero typing, handles subtitle conversion and HEVC tagging automatically, and works on any device without installing anything.
For GUI re-encoding with quality controls, HandBrake is the best free option. For quick conversions when you already have it installed, VLC works in a pinch. And for cloud-based conversion, CloudConvert handles it without any local software — though with upload time and file size limits.
Just need MKV as MP4? Skip the terminal.
Drop your MKV into the free MKV to MP4 converter — it runs entirely in your browser, just like ffmpeg -c copy but with drag-and-drop. No upload, no install, no account. Works on Mac, Windows, and Linux.