Utilo

MKV MIME Type – Free, Online, Private

video/matroska is the registered type for a Matroska video file. WebM is a subset and uses video/webm instead.

What .mkv is

Matroska is an EBML container. The file starts with 1A 45 DF A3, like WebM, and the DocType string is matroska rather than webm. It can hold nearly any codec: H.264, H.265, AV1, DTS, FLAC, subtitles in several formats, and attachments such as fonts. RFC 9559 registers video/matroska and audio/matroska. .mka is the audio extension and .mk3d is the stereoscopic one. This page is .mkv. A WebM file is intentionally a restricted Matroska file and must be video/webm, not this type, when you want a browser to accept it under the WebM rules.

IANA registers video/matroska in RFC 9559. audio/matroska is the audio-only type. The media type is video/matroska. Extensions that use it on this page: .mkv. A client compares the type, not the filename, once the response has arrived. The filename still matters on disk and in Content-Disposition, which is why a wrong extension and a wrong header are two different bugs.

What sends video/matroska

What sends video/matroska: Send video/matroska for a .mkv download. Playback in a browser is inconsistent once the codec leaves the WebM subset, and subtitle tracks are not something a plain video element handles well. For a web player, transmux to video/mp4 or video/webm. Keep Matroska for archives and for players that read it, such as desktop media players. A codecs parameter is defined by the RFC and is worth sending when you know the CodecID mapping. Ranges help a player seek using the Cues. The file on disk is still .mkv. Once the response exists, a client trusts video/matroska, not the filename. If you archive a broadcast in MKV and publish a preview in MP4, store the relationship in your database. The preview's type is video/mp4. Replacing the archive bytes in place under the preview URL is how a 50 GB Matroska file gets cached as a phone video.

Content-Type for .mkv

Send video/matroska and do not add a charset parameter. The body is binary. A charset tells a text decoder to reinterpret bytes that are not text, which corrupts a download and does not help a browser sniff the format.

Content-TypeContent-Type: video/matroska

nginx, Apache, and Express

These snippets map .mkv to video/matroska. nginx reads the types block when it picks a type from the URL's extension. A location that sets default_type, or an application that sets the header itself, overrides that map. Apache AddType applies in the directory context where you put it. The Express static example writes the header for files ending in .mkv so a stale mime database in the framework cannot disagree with the type on this page.

nginx# /etc/nginx/mime.types, inside the types { } block
video/matroska              mkv;
ApacheAddType video/matroska .mkv
Expressimport express from "express";

const app = express();
app.use(express.static("public", {
  setHeaders(res, filePath) {
    if (filePath.endsWith(".mkv")) {
      res.setHeader("Content-Type", "video/matroska");
    }
  },
}));

Pitfalls for video/matroska

Pitfalls that show up for video/matroska, and not for a neighboring type with a similar extension: Labeling Matroska as video/webm because the magic bytes match is the bug. Read DocType. Labeling it video/x-matroska is what old mime.types files did. RFC 9559's type is video/matroska, and new configuration should send that. Another trap is an attachment inside the file that is a font or a cover image. A naive extractor writes those to disk with the video's type. Give extracts their own types. A third is a file with ordered chapters that a transmuxer flattens without telling anyone the timestamps moved.

  • video/x-matroska is the unofficial value still found in older servers. Prefer video/matroska.
  • audio/matroska is correct for .mka. Do not send video/matroska for an audio-only archive if you can avoid it.
  • EBML element sizes that overflow the file are a truncated download, not a new type.
  • Subtitles in a track do not change the top-level type. A lone .srt file is not video/matroska.

Frequently asked questions

Is video/matroska registered?

Yes. RFC 9559 registers video/matroska and audio/matroska.

How do I tell MKV from WebM?

Both start with EBML 1A 45 DF A3. The DocType is matroska or webm. WebM responses should use video/webm.

Should a website stream MKV?

Not to a browser video element if you can transmux. Use video/matroska for the archive download.

What about video/x-matroska?

It is the old unofficial map. New responses should use video/matroska.