What Is a .MKV File?
Matroska
Matroska Multimedia Container (.mkv)
Overview
Matroska is an open, royalty-free multimedia container format. An .mkv file is not a codec or a kind of compression - it is a wrapper that can hold an effectively unlimited number of video, audio, subtitle, and attachment tracks in a single file, along with chapters, tags, and menu structures.
This distinction matters when identifying files: two .mkv files can contain entirely different codecs (H.264 in one, AV1 in another) while sharing the same container structure. Detection tools recognise the Matroska container itself; working out the codecs inside requires parsing the track headers.
Technical Specifications
Format Details
- MIME Type:
video/x-matroska - File Extensions:
.mkv(video),.mka(audio only),.mks(subtitles only),.mk3d(stereoscopic 3D) - Category: Video
- Underlying format: EBML (Extensible Binary Meta Language)
- First released: 2002
- Licence: Open standard, royalty-free
- Magic bytes:
1A 45 DF A3
Identifying a Matroska File
Every Matroska file opens with the four-byte EBML header:
00000000 1a 45 df a3 a3 42 86 81 01 42 f7 81 01 42 f2 81 |.E...B...B...B..|
00000010 04 42 f3 81 08 42 82 88 6d 61 74 72 6f 73 6b 61 |.B...B..matroska|
The ASCII string matroska appears in the DocType element shortly after the header. WebM files share the same 1A 45 DF A3 signature but declare DocType as webm, which is how detectors tell the two apart.
File Structure
Matroska organises data as a tree of EBML elements, each identified by a variable-length ID followed by a variable-length size and a payload.
EBML Header
DocType: "matroska"
DocTypeVersion: 4
Segment
├── SeekHead (index of top-level elements)
├── Info (duration, timestamp scale, muxing app)
├── Tracks
│ ├── TrackEntry #1 video V_MPEG4/ISO/AVC 1920x1080
│ ├── TrackEntry #2 audio A_OPUS 48 kHz stereo
│ └── TrackEntry #3 subtitle S_TEXT/UTF8 English
├── Chapters (named, seekable sections)
├── Cluster ... (the interleaved media data itself)
├── Cues (seek index)
├── Attachments (fonts, cover art, arbitrary files)
└── Tags (metadata)
Because EBML is self-describing and length-prefixed, a parser that meets an element it does not recognise can skip it cleanly. That is what allows the format to gain features without breaking older players.
History and Development
Matroska began in 2002 when Steve Lhomme forked the Multimedia Container Format project, replacing its custom binary structure with EBML to make the format extensible. Development has been community-led under the Matroska organisation.
In 2010 Google derived WebM from Matroska, restricting it to a small set of royalty-free codecs (initially VP8 and Vorbis, later VP9, AV1, and Opus) for use with HTML5 video. WebM remains a strict subset of the Matroska structure.
The IETF's CELLAR working group has since been formalising Matroska, EBML, and the FFV1 codec as internet standards, which matters for long-term archival commitments.
Common Use Cases
- High-definition video distribution: the usual container for high-bitrate video where multiple audio tracks and subtitle languages are expected.
- Multi-language releases: one file carrying several dubbed audio tracks and a dozen subtitle tracks, selectable at playback.
- Archival and preservation: lossless video (FFV1) with lossless audio (FLAC) in Matroska is a common archival combination, used by national libraries and film archives.
- Anime and fansub distribution: support for soft subtitles, attached fonts, and chapters made it the community standard.
- Screen recording: OBS Studio records to MKV by default because the format survives an abrupt end far better than MP4.
How to Open an MKV File
Media players (all platforms)
- VLC Media Player: plays virtually every codec combination without extra downloads. The safest first choice.
- mpv: lightweight, scriptable, excellent subtitle rendering.
- MPC-HC / MPC-BE (Windows) - long-standing lightweight players with full Matroska support.
- PotPlayer (Windows) - extensive track and filter controls.
- IINA (macOS) - a modern mpv front-end that fits macOS conventions.
Built-in support
- Windows 10 and 11: the Movies & TV app plays MKV natively.
- macOS QuickTime: does not support MKV; use VLC or IINA instead.
- Smart TVs and consoles: support varies widely and usually depends on the codecs inside rather than the container.
Inspecting contents
# List every track, codec, and language in the file
ffprobe -hide_banner movie.mkv
# Detailed Matroska-specific structure
mkvinfo movie.mkv
# Concise track summary
mkvmerge -i movie.mkv
Working with MKV Files
Remuxing without re-encoding
Changing the container while keeping the streams bit-identical is fast and lossless:
# MKV to MP4, no quality loss, no re-encode
ffmpeg -i input.mkv -c copy output.mp4
# MP4 to MKV
ffmpeg -i input.mp4 -c copy output.mkv
MP4 cannot carry every codec Matroska can. Subtitle formats in particular (ASS/SSA) have no MP4 equivalent and will be dropped or need conversion.
Editing tracks with MKVToolNix
# Keep only the video and the second audio track
mkvmerge -o trimmed.mkv --audio-tracks 2 --no-subtitles movie.mkv
# Add an external subtitle file
mkvmerge -o with-subs.mkv movie.mkv --language 0:eng subtitles.srt
# Extract a subtitle track
mkvextract tracks movie.mkv 3:subtitles.ass
Extracting audio
ffmpeg -i movie.mkv -vn -c:a copy audio.mka
Advantages
- Codec-agnostic: carries essentially any audio or video codec, including future ones.
- Unlimited tracks: multiple audio languages, subtitle sets, and attachments in one file.
- Error resilience: a truncated or partially corrupted file usually remains playable up to the damage.
- Rich metadata: chapters, tags, cover art, and attached fonts are first-class features.
- Open and royalty-free: no licensing cost for implementers.
Limitations
- Uneven hardware support: many TVs, phones, and older players prefer MP4; support depends on both container and codec.
- No native Apple support: QuickTime and the default iOS players will not open MKV.
- Limited streaming use: MP4 and fragmented MP4 dominate HTTP adaptive streaming; Matroska is rare in that role, with WebM covering the browser case.
- Large files: the container itself is efficient, but MKV is typically used for high-bitrate content, so files are often very large.
Related Formats
File Information
Matroska
Video
.mkv
video/x-matroska
Related File Types
Other file types in the Video category you might also need:
Start Analyzing MKV Files Now
Use our free AI-powered tool to detect and analyze Matroska files instantly with Google's Magika technology.
⚡Try File Detection Tool