AV1 Video in Matroska: MKV Mapping Explained

This article provides an overview of how the AOMedia Video 1 (AV1) bitstream is encapsulated within the Matroska (MKV) multimedia container. Matroska accommodates AV1 by standardizing a specific Codec ID, embedding a configuration record inside the track headers, and packing AV1 Open Bitstream Units (OBUs) into standard Matroska data blocks. Understanding this integration is essential for developers, multimedia engineers, and video enthusiasts looking to package or demux modern AV1 streams efficiently.

The Codec Identifier

In Matroska, every track must define a CodecID string to signal the decoding format to demuxers. For AV1 video tracks, the standard identifier is:

This string explicitly signals that the elementary stream contained in the track's clusters conforms to the AV1 bitstream specification defined by the Alliance for Open Media (AOMedia).

Track Initialization with CodecPrivate

The CodecPrivate element in the Matroska TrackEntry holds the global configuration data necessary to initialize the AV1 decoder prior to decoding frames.

Matroska adopts the AV1CodecConfigurationRecord format (identical to the structure used in the MP4/ISOBMFF container binding). The CodecPrivate data contains:

Embedding the Sequence Header OBU within CodecPrivate guarantees that the decoder can configure its decoding pipeline immediately upon demuxing the track, even before processing the first video frame.

Encapsulating OBUs in Matroska Blocks

AV1 elementary streams consist of a sequence of Open Bitstream Units (OBUs). When mapped into Matroska:

Timestamps and Keyframe Detection

Matroska handles presentation timing and seeking through its own track-level metadata: