Standards: Containers - Matroška Container Files
Open-source, royalty-free and endlessly extensible, Matroška has become the container of choice for modern video distribution and the foundation for formats like WebM. This guide explains its nested element structure, maps the IANA registries that govern it, and shows why MKV keeps gaining ground.
Matroška File Containers (MKV)
This is an open-source project for a container supporting an unlimited number of media tracks in a single file. This container is extremely versatile and free of royalties. This makes it very attractive as a starting point for other container designers to use and extend.
Although the Matroška format is not from a Russian heritage, it is so named because the internal nested structure resembles the small hollow wooden dolls from Russia. Opening each doll reveals another smaller one inside. This illustrates the way that objects are owned by other objects in a hierarchical tree structure inside the container.
Internally, the file is object structured like QTFF or ISOBMFF. The objects in a Matroška file are called elements and are documented at the Matroška web site:
https://www.matroska.org/
The element types are more rigidly defined than ISOBMFF. Matroška element codes are arguably less mnemonic and have a logical pattern when expressed in the hexadecimal notation. The ISOBMFF and QTFF type codes are more humanly readable. At the application coding and inspection level, a symbolic lookup table can map these values to more easily understood texts. Some older element types have been deprecated where they were sub-optimally designed or were rarely used.
The Matroška format is standardized as RFC 9559 and has the following features:
- Fast seeking in the file for navigation.
- Chapter entries that work like DVD scenes.
- Full metadata (tags) support.
- Selectable subtitle/audio/video streams.
- Expandable by adding new modules.
- Error resilience allowing playback to be resynchronized.
- Can be streamed over the Internet and local networks.
- Supports DVD-like menus for content selection.
There have so far been four versions of the Matroška format. Version 4 is current and maintained. The older versions are stabilized with no changes being released. Make sure that you are using the latest version.
Extensible Binary Meta Language (EBML)
EBML is a binary container format designed for audio/video storage. Structurally it is similar to XML but more compact. It uses a storage-efficient approach to build nested elements with identifiers, lengths, and values. This is sometimes described as Key-Length-Value (KLV) coding.
The RFC 8794 specification for EBML is updated by the later RFC 9559 that describes the Matroška container format. This fixes an oversight with one of the element IDs as an erratum. This is necessary because the affected element is used in Matroška but was previously reserved in EBML.
Content Organization - Levels
Content can be tagged and organized into a hierarchy of nested item levels. This structure can be applied to audio or video content. Interesting user interface possibilities arise from this kind of content organization:
| Level | Content |
|---|---|
| 1 | Shot. |
| 2 | Sub-track, Movement, Scene. |
| 3 | Track, Song, Chapter. |
| 4 | Part, Session. |
| 5 | Album, Opera, Concert, Movie, Episode. |
| 6 | Edition, Issue, Volume, Opus, Season, Sequel. |
| 7 | Collection. |
Content Arrangement - Track Types
The following track types are supported within a Matroška file. They are all described in RFC 9559:
| Type | Number | Description |
|---|---|---|
| Invalid | 0 | It is prohibited to specify an illegal track type 0 (zero). |
| Video | 1 | Stores video streams, including specialized .mk3d files for 3D/stereoscopic video. Each frame contains an image. |
| Audio | 2 | Stores audio sample streams (e.g., AAC, AC3, DTS, Vorbis), often in .mka (audio-only) or .mkv files. |
| Complex | 3 | A mix of different other track type combinations. The codec needs to define how the Matroška Player should interpret such data. |
| Logo | 16 | Visual logo imagery to be rendered over the video track(s). |
| Subtitle | 17 | Subtitle or closed caption data to be rendered over the video track(s). Often used in .mks files. |
| Buttons | 18 | Interactive menu button(s) to be rendered over the video track(s). |
| Control | 32 | Metadata used to control the user interface of the Matroška Player. |
| Metadata | 33 | Timed metadata that can be passed on to the Matroška Player. |
Create and register your own track types with the IANA if none of these meets your needs. Consult RFC 8126 for guidelines on how to document your new track type for submission.
IANA Registries
The IANA maintains the following registries for the Matroška project. The changes to the registries are managed by the IETF:
| Registry | Description |
|---|---|
| Element Codes | Defines the binary structure elements with additional properties that help to diagnose malformed data in the container. |
| Compression Algorithms | This registry defines the compression methods applied to a track. |
| Encryption Algorithms | This registry defines the algorithm used for encrypting track data. |
| Cipher Modes | The AES cipher mode used in the encryption. |
| Content Encoding Scope | These define what part of the track is affected by the compression/encryption. |
| Content Encoding Types | A value describing the kind of transformation that is applied. |
| Stereo Modes | Stereo-3D video mode. |
| Alpha Modes | Indicates the kind of alpha channel support being used. |
| Display Units | How DisplayWidth and DisplayHeight are interpreted. |
| Horizontal Chroma Sitings | How chroma is subsampled horizontally. |
| Vertical Chroma Sitings | How chroma is subsampled vertically. |
| Color Ranges | Clipping of the color ranges. |
| Tags Target Types | A number to indicate the logical level of the target. |
| Chapter Codec IDs | Contains the type of codec used for processing individual chapters. |
| Projection Types | Describes the projection used for this video track to texture map the image onto a surface. |
| Track Types | Identifies track content (e.g., video, audio, subtitles). |
| Track Plane Types | The kind of plane this track corresponds to. This applies to stereoscopic presentations where the plane can be background, left or right eye. |
Find the IANA Matroška registries here:
https://www.iana.org/assignments/matroska/matroska. xhtml
Relationships To Other Formats
Matroška was forked from the Multimedia Container Format (MCF) open-source project in 2002. Matroška uses Extensible Binary Metalanguage internally to organize the content. It has been around for quite some time now and is a mature technology.
The WebM container was initially based on Matroška to carry VP8 video and Vorbis audio.
Microsoft added support for HEVC video carried in a Matroška container in Windows 10.
Media Type Identifiers
Applications should recognize the legacy types but they should not be used for new projects now that the official types without the ‘X-’ prefix have been defined.
| Media type | Description |
|---|---|
| video/matroska | Video files. |
| video/matroska-3d | Stereoscopic video files. |
| audio/matroska | Audio only files. |
| application/octet-stream | Subtitle and other arbitrary media files. |
| video/x-matroska | Legacy type. |
| audio/x-matroska | Legacy type. |
| video/x-matroska-3d | Legacy type. |
File Name Extensions
These are the file name extensions for generic Matroška container files. When the files are used for specialized applications they may change the file name extension so they can ‘own’ the file.
| Media type | Description |
|---|---|
| .mkv | Video content with optional audio and subtitles. |
| .mk3d | Stereoscopic video. |
| .mka | Audio only files. |
| .mks | Subtitle only files. |
Relevant Standards
These standards are relevant when you are using or developing Matroška container formats:
| Document | Document | Description |
|---|---|---|
| IEEE.754 | 2019 | IEEE Standard for Binary Floating-Point Arithmetic. |
| ISO 9899 | 2024 | Programming languages - C. |
| ISO 13239 | 2002 | High-level data link control (HDLC) procedures. |
| ITU-T V42 | 2003 | Error-correcting procedures for DCEs using asynchronous-to-synchronous conversion. |
| RFC 20 | 1969 | ASCII format for network interchange. |
| RFC 2119 | 1997 | Key words for use in RFCs to indicate requirement levels. |
| RFC 2648 | 1999 | A URN Namespace for IETF documents. |
| RFC 3339 | 2002 | Date and time on the internet timestamps. |
| RFC 3629 | 2003 | UTF-8, a transformation format of ISO 10646. |
| RFC 3688 | 2004 | The IETF XML Registry. |
| RFC 5234 | 2008 | Augmented BNF for Syntax Specifications (ABNF). |
| RFC 5646 | 2009 | Tags for identifying languages. |
| RFC 7405 | 2014 | Case-sensitive string support in ABNF. |
| RFC 8126 | 2017 | Guidelines for writing an IANA considerations section in RFCs. |
| RFC 8141 | 2017 | Uniform Resource Names (URNs). |
| RFC 8174 | 2017 | Ambiguity of uppercase vs lowercase in RFC 2119 Key Words. |
| RFC 8794 | 2020 | Extensible Binary Meta Language. |
| RFC 9559 | 2024 | Matroška Media Container Format specification. |
| XHTML | 2018 | XHTML Basic 1.1 -- Second Edition. |
| XML | 2008 | Extensible Markup Language (XML) 1.0 (Fifth Edition). |
| XML-SCHEMA | 2012 | XML Schema Version 1.1. |
Applying Matroška Containers
All things considered, the Matroška format is probably a very good choice if you are building a workflow infrastructure. It has few limitations and because it is open sourced there are no license fees. The source code is available and easy to customize.
Matroška is designed for future expansion. New elements can be added and the IANA registries show how the internal format and structure can be data driven.
The open-source nature of Matroška virtually guarantees that it will be a successful format as is already evident by the way it is deployed natively or used as the basis for other new formats.
These Appendix articles contain additional information you may find useful:
Supported by
You might also like...
IP Security For Broadcasters - The Book 2026
Security is everyone’s problem. It is not just about having the right policies in place or knowing where the vulnerabilities in your network are; it’s about understanding how the network is accessed and by whom, and how to str…
Broadcast Standards - The Science Of AI: New Foundations
We begin this series with the foundational building blocks of AI. Basic principles, the technology stack and the types of AI based upon it, and how to apply them effectively in a broadcasting enterprise.
Standards: Audio - MPEG Layer 3 Audio Coding (MP3)
Launched in 1995, MP3 remains one of the most ubiquitous audio formats in the world. This guide explains how psychoacoustic compression works, explains the differences between MPEG-1 and MPEG-2 implementations, and finds out where MP3 works – and where it doesn’t.
Network Traffic Engineering: Head-Of-Line Blocking - Why QUIC Changes The Rules
Head-of-line blocking turns minor packet loss into visible glitches by stalling entire TCP streams until missing data is retransmitted. Eliminating cross-stream blocking by multiplexing independent streams over UDP, QUIC might be the answer for OTT delivery, cloud workflows and the…
Standards: Audio - Standards For Audio Coding
Audio coding demands very different tools and workflows to video, but the same fundamental principles around quality apply to both. This guide surveys the standards, codecs and container formats you need to navigate modern audio workflows.