DevToolsmith

MKV MIME Type

video/x-matroska is the MIME type for Matroska video (.mkv). Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
video/x-matroska
Extensions
.mkv, .mka
Content-Type header
video/x-matroska
Registered
No, a common convention
Compress with gzip
No, it is already compressed
Category
Video

About Matroska video files

A flexible container that can hold almost any codec, plus multiple audio and subtitle tracks. WebM is a restricted subset of Matroska. RFC 9559 (2024) registered video/matroska, but most servers still send video/x-matroska. Browsers don’t officially support .mkv, though Chrome plays some files whose codecs it knows; remux or transcode to MP4 or WebM for the web.

Other types seen for these files: video/matroska , audio/matroska , audio/x-matroska . Accept them when reading uploads, but send video/x-matroska yourself.

File signature

MKV files start with 1A 45 DF A3 (EBML header, shared with WebM). The extension and the type a browser reports for an upload both come from the file name, so check these bytes on the server before trusting a file.

Serve .mkv with the right Content-Type

Response header
Content-Type: video/x-matroska
nginx (a line in the types { } block of mime.types)
video/x-matroska mkv mka;
Apache (.htaccess or server config)
AddType video/x-matroska .mkv .mka
Caddy
@mkv path *.mkv *.mka
header @mkv Content-Type "video/x-matroska"
Check what a server sends
curl -sI https://example.com/file.mkv | grep -i '^content-type'
# Content-Type: video/x-matroska

Set the type in code

Node.js (Express)
res.set('Content-Type', 'video/x-matroska');
// Or make the browser download it:
res.attachment('file.mkv');
Python
import mimetypes

mimetypes.add_type('video/x-matroska', '.mkv')  # if your system doesn't know it
mimetypes.guess_type('file.mkv')[0]  # 'video/x-matroska'
Go
mime.AddExtensionType(".mkv", "video/x-matroska")
w.Header().Set("Content-Type", "video/x-matroska")

Accept .mkv uploads

HTML
<input type="file" accept=".mkv,.mka,video/x-matroska">

The accept attribute only filters the file picker; users can still choose another file. Listing the extension as well as the type matters, because operating systems don’t always report the type you expect.

Related types

  • .webm (video/webm): WebM video
  • .mp4 (video/mp4): MP4 video
  • .avi (video/x-msvideo): AVI video

More video

.mov , .m3u8 , .ts . Look up any extension or type with the MIME type lookup.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What is the MIME type for .mkv files?

video/x-matroska. You may also see video/matroska, audio/matroska, audio/x-matroska, which are older or unofficial; send video/x-matroska. The full header is "Content-Type: video/x-matroska".

Why does my server send the wrong Content-Type for .mkv?

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .mkv is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".

How can I check that a file really is MKV?

Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. MKV files start with 1A 45 DF A3 (EBML header, shared with WebM). The MIME type lookup on this site reads them for you when you drop a file on it.