Skip to content
MKV to MP4

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.mp4

The -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.mp4

Useful 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.mp4

H.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.mp4

If 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)
InterfaceCommand line — requires terminal knowledgeDrag-and-drop in browser — no commands needed
InstallManual download + PATH setup on most systemsNone — opens in any modern browser
Remux speedSeconds (reads/writes at disk speed)Seconds (reads/writes via browser APIs)
Codec error handlingFails with error message — you fix the commandAutomatically handles compatible streams
Batch supportYes — via shell scriptingYes — drop up to 20 files at once
Subtitle handlingManual flags for each stream (-c:s mov_text)Text subs converted to MP4 format automatically
Best forPower users who want full control over every streamAnyone 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.

FFmpeg MKV to MP4 — questions

What is the FFmpeg command to convert MKV to MP4 without re-encoding?

Run: ffmpeg -i input.mkv -c copy output.mp4. The -c copy flag tells FFmpeg to copy all streams (video, audio, subtitles) without decoding or re-encoding. This is called a remux — it finishes in seconds and preserves 100% of the original quality.

Why does FFmpeg say 'could not find tag for codec' when remuxing MKV to MP4?

MP4 doesn't support every codec that MKV does. Common culprits are Vorbis audio, PGS bitmap subtitles, and VP9 video. You'll need to either re-encode the incompatible stream (e.g. -c:a aac) or drop it (-an for audio, -sn for subtitles) to get a valid MP4.

Does FFmpeg lose quality when converting MKV to MP4?

Not if you use -c copy to remux. The video and audio data is transferred bit-for-bit — the output is identical to the source. Quality loss only happens when you re-encode, which means FFmpeg decodes and compresses the streams again. Even then, you control the quality via CRF or bitrate settings.

How do I batch convert multiple MKV files to MP4 with FFmpeg?

On Linux/macOS, use a shell loop: for f in *.mkv; do ffmpeg -i "$f" -c copy "${f%.mkv}.mp4"; done. On Windows CMD: for %f in (*.mkv) do ffmpeg -i "%f" -c copy "%~nf.mp4". Both commands remux every MKV in the current folder.

Do I need to install FFmpeg to convert MKV to MP4?

FFmpeg is a command-line tool that you download and install manually — it's not a one-click installer on most systems. If you'd rather skip the terminal entirely, browser-based tools powered by the same FFmpeg libraries can remux MKV to MP4 locally without any install.