MKV (Matroska) Video Container Format — Complete Guide
What Is MKV?
MKV (Matroska Video) is an open, royalty-free multimedia container format developed by the Matroska project, initially released in December 2002. It is based on the Extensible Binary Meta Language (EBML), a binary derivative of XML that provides flexible, forward-compatible structure. MKV can hold virtually unlimited video streams, audio tracks, subtitle tracks, chapters, metadata, and file attachments in a single self-contained file.
Unlike proprietary containers such as AVI (limited to two streams) or MP4 (governed by ISO/MPEG standards with codec restrictions), Matroska imposes no codec constraints and is maintained by an independent non-profit organisation, making it the format of choice for archivists, home-media enthusiasts, and fan-dubbing communities worldwide.
EBML: The Foundation of Matroska
EBML (Extensible Binary Meta Language) gives Matroska its flexibility. Every piece of data in an MKV file is an Element consisting of:
- Element ID — variable-length integer identifying the element type
- Data Size — variable-length integer giving the byte length
- Data — raw content (binary, UTF-8 string, integer, float, or nested elements)
The top-level Matroska structure:
EBML Header
Segment
├─ SeekHead (index of top-level elements)
├─ Info (title, duration, timecode scale, muxing app)
├─ Tracks (video/audio/subtitle track definitions)
├─ Chapters (chapter markers)
├─ Tags (metadata key-value pairs)
├─ Attachments (embedded files — fonts, images)
└─ Cluster(s) (actual media data, in time-ordered blocks)
This hierarchical design means readers can skip unknown elements gracefully — future extensions never break existing parsers.
Video Codec Support
MKV is codec-agnostic. Any video codec can be encapsulated; commonly used ones include:
Modern High-Efficiency Codecs
- H.265/HEVC — 2× the compression of H.264; dominant in 4K Blu-ray rips and HDR encodes
- AV1 — royalty-free, ~30 % more efficient than H.265; used in next-generation streaming and archival
- VP9 — Google's open codec; used in YouTube 4K; moderate hardware support
Mainstream Codecs
- H.264/AVC — universal hardware support; dominant in internet video; baseline for most devices
- VP8 — predecessor to VP9; rarely used in new MKV files
Professional and Legacy Codecs
- FFV1 — lossless video codec; used by national archives and film preservation projects
- HuffYUV / Lagarith — near-lossless codecs for intermediate editing
- MPEG-2 — legacy codec; DVD-rip sources occasionally stored in MKV
Audio Codec Support
Lossless Audio
- FLAC — Free Lossless Audio Codec; 40–60 % smaller than raw PCM; popular for archival
- TrueHD — Dolby lossless codec; used on Blu-ray; bit-perfect preservation of surround mixes
- DTS-HD MA — DTS lossless variant; cinema-standard multi-channel audio
- PCM (raw) — uncompressed; maximum quality; large file size
High-Quality Lossy Audio
- AAC — standard for mobile and streaming; efficient at 128–256 kbps; wide hardware support
- Opus — modern open codec; excellent at low bitrates (32–128 kbps); dominates VoIP and podcasting
- Vorbis — open-source predecessor to Opus; still widely used in MKV files
- AC-3 (Dolby Digital) — 5.1 cinema audio; 192–640 kbps; broad device support
- E-AC-3 (Dolby Digital Plus) — enhanced AC-3; higher bitrate and efficiency; used on streaming
- DTS — cinema lossy surround; universal AV receiver support
Subtitle Format Support
Matroska's subtitle system is one of its greatest strengths:
Text-Based Subtitles
- SubRip (.srt) — plain timing + text; most common format; stored as UTF-8 in MKV
- SubStation Alpha / Advanced SubStation Alpha (.ssa/.ass) — rich styling (fonts, colours, outlines, positioning, karaoke effects, per-character animation); dominant in anime fansubs
- WebVTT — web standard; stored natively in MKV for future-compatible streaming
- HDMV TextST — Blu-ray text subtitles; rarely used in MKV
Bitmap-Based Subtitles
- VobSub (.idx/.sub) — DVD bitmap subtitles extracted as image frames; pixel-perfect but large
- PGS (Presentation Graphics Stream) — Blu-ray bitmap subtitles; high fidelity; ~5–15 MB per hour
Embedded Fonts for ASS/SSA
MKV's Attachments section holds TrueType (.ttf) and OpenType (.otf) font files. When a player (VLC, mpv, MPC-HC) encounters an MKV with embedded fonts, it extracts them to a temporary directory and uses them for subtitle rendering — guaranteeing visual fidelity regardless of the system's installed fonts.
Chapter Support
Chapters in MKV work similarly to DVD chapter markers:
Chapter 1 "Opening Titles" 00:00:00.000
Chapter 2 "Act One" 00:03:45.200
Chapter 3 "Intermission" 00:58:12.000
Chapter 4 "Act Two" 01:00:00.000
Chapter 5 "Closing Credits" 01:52:40.500
Chapters can be ordered (the player jumps between non-contiguous segments — enabling branching or seamless looping) or unordered (standard linear navigation). This enables DVD-like menu-less chapter selection in a single flat file.
Metadata and Tags
MKV's Tags element supports arbitrary key-value metadata at segment, track, chapter, or attachment level. Standard Matroska tags include:
TITLE,DATE_RELEASE,DIRECTOR,ACTOR,GENRE,COMMENT,DESCRIPTIONTOTAL_PARTS/PART_NUMBER— season/episode numbering for TV seriesBPS,DURATION,NUMBER_OF_FRAMES— technical track statisticsRATING,CONTENT_TYPE,LANGUAGE— catalogue information
Cover art (poster images) are stored as attachments with the MIME type image/jpeg or image/png and the filename cover.jpg / cover.png.
Advantages of MKV
- Open and royalty-free — no licensing fees; anyone can implement a parser or muxer
- Unlimited tracks — no practical limit on video, audio, subtitle, or attachment streams
- Lossless audio — FLAC and TrueHD preserve bit-perfect audio fidelity
- Advanced subtitle styling — ASS/SSA + embedded fonts for professional-grade subtitles
- Future-proof — unknown elements are safely ignored by older parsers; format extensions don't break compatibility
- Self-contained — chapters, metadata, subtitles, and fonts all travel with the video in one file
- Error recovery — Cluster-level structure allows partial playback of damaged or incomplete files
Disadvantages of MKV
- Limited hardware support — most smart TVs, Blu-ray players, gaming consoles, and media streamers cannot play MKV natively; conversion to MP4 is often needed
- No browser support — HTML5 video does not accept MKV; web publishing requires MP4 or WebM
- No streaming optimisation — MP4's moov atom can be placed at the file start for HTTP pseudo-streaming; MKV has no equivalent mechanism for progressive web download
- Larger overhead — EBML element wrapping adds a small size penalty (~0.1–0.5 %) versus optimised MP4 containers
- Encoding speed — multi-track muxing with lossless audio is slower than single-track MP4 encoding
Device and Software Compatibility
| Environment | Status |
|---|---|
| VLC (all platforms) | Full native support |
| mpv | Full native support |
| Windows Media Player (Win 11) | Requires codec pack or MKV extension |
| Plex / Kodi / Jellyfin | Full; transcodes for incompatible clients |
| Smart TVs (LG, Samsung, Sony) | Partial — depends on embedded codec and track count |
| Apple TV (tvOS) | Via Infuse or Plex only |
| Roku / Fire TV | Via Plex or VLC app; not native |
| PlayStation 5 | Limited — some MKV files play, many do not |
| Xbox Series X | Partial; H.264 + AAC MKV usually works |
| iOS / iPadOS | Via VLC, Infuse, or nPlayer apps |
| Android | Via VLC, MX Player, or Kodi |
MKV vs. MP4: When to Choose Each
Choose MKV when:
- Archiving a film or TV series with multiple audio languages and subtitle tracks
- Lossless audio quality (FLAC, TrueHD) is required
- Rich subtitle styling with embedded fonts is needed (anime, fansubs)
- Long-term preservation where codec flexibility matters
Choose MP4 when:
- Universal device compatibility is the priority
- Uploading to YouTube, Vimeo, or any streaming platform
- Playing on smart TVs, gaming consoles, or mobile without extra apps
- Sharing with general audiences unfamiliar with media players
Converting MKV Files
Converting MKV to MP4 is lossless for the video stream (stream copy) when both containers support the same codec (e.g., H.264 or H.265). Audio tracks are copied directly if they are AAC or MP3; AC-3, FLAC, and TrueHD typically require re-encoding to AAC for MP4 compatibility. KaijuConverter handles MKV input natively, selecting the optimal output profile automatically.
Use Cases
Home Media Library — Plex and Kodi users store rips of purchased Blu-rays in MKV with original H.265 video, DTS-HD MA audio, and multiple subtitle languages. One self-contained file replaces a physical disc.
Anime Fansubs — Fansubbing groups release MKV files with ASS subtitles featuring custom fonts, karaoke effects, and per-character styling impossible in any other widely-used format.
Film Preservation — Archivists use MKV + FFV1 (lossless video) + FLAC (lossless audio) for digital film preservation. FLAC reduces audio storage by 50–60 % versus raw PCM while maintaining mathematical bit-for-bit accuracy.
Educational Content — University lecture recordings archived in MKV bundle multiple language dubs and accessibility subtitle tracks. A single 2 GB file replaces five separate per-language MP4 files.
Related conversions
Common video conversions that pair well with this guide: