mediacodec.dev

Convert anything to MP4

Most "convert to MP4" jobs need no conversion at all. MP4 is a container, not a codec, and if the video inside your MKV is already H.264, the streams can move into an MP4 box untouched in about a second. Re-encoding is the fallback for codecs MP4 cannot carry, not the default.

Coming from

-i

Usually H.264/H.265 inside: a remux almost always works.

Only changes the input filename here, but it decides how likely a remux is to work: MKV and MOV usually carry MP4-compatible codecs already.

How

-c copy

The compressed data moves between containers bit for bit: no quality loss, no encode time. Fails fast if a codec is not MP4-compatible, and then you re-encode.

Try the copy first, always. It is lossless and near-instant, and FFmpeg will tell you immediately if a stream cannot travel into MP4.

Your command

ffmpeg -i input.mkv -c copy \
  -movflags +faststart \
  output.mp4

Worth knowing

-movflags +faststart moves the index to the front of the file so playback can start before the download finishes. It costs nothing and every web MP4 should have it.

If a remux fails with "codec not currently supported in container", that stream genuinely cannot live in MP4: re-encode that stream only, e.g. -c:v copy -c:a aac for an audio-only problem.

Subtitle streams are the usual remux tripwire: MKV soft subs (ASS/SSA) do not fit MP4. Add -sn to drop them, or -c:s mov_text to convert them.

Run this on your own file

no FFmpeg · runs in this tab

The command above needs FFmpeg on a machine. The settings it encodes do not: your browser can perform the same operation on a real file, right here, through WebCodecs.

Drop a video or audio file here, or

Files are processed in this tab and never uploaded.

A true remux: when MP4 can carry the source codecs, Mediabunny copies the compressed packets over untouched, and the run finishes in about the time it takes to read the file.

Audio whose timestamps start below zero (AAC encoder delay does this) gets re-encoded rather than copied; FFmpeg handles that case with an edit list instead.

Waiting on a file.