| RFC 9559 | Matroska Format | March 2024 |
| Lhomme, et al. | Standards Track | [Page] |
This document defines the Matroska audiovisual data container structure,including definitions of its structural elements, terminology,vocabulary, and application.¶
This document updates RFC 8794 to permit the use of a previously reserved Extensible Binary Meta Language (EBML) Element ID.¶
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained athttps://www.rfc-editor.org/info/rfc9559.¶
Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
Matroska is an audiovisual data container format. It was derived from aproject called[MCF] but diverges from itsignificantly because it is based on EBML (Extensible Binary Meta Language)[RFC8794], a binary derivative of XML. EBMLprovides significant advantages in terms of future format extensibilitywithout breaking file support in parsers reading the previous versions.¶
First, it is essential to clarify exactly "What an Audio/Video container is", to avoid any misunderstandings:¶
Matroska is designed with the future in mind. It incorporates features such as:¶
This document covers Matroska versions 1, 2, 3, and 4. Matroska version 4 is the current version.Matroska 1 to 3 are no longer maintained. No new elements are expected in files with version numbers 1, 2, or 3.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14[RFC2119][RFC8174] when, and only when, they appear in all capitals, as shown here.¶
This document defines specific terms in order to define the format and application ofMatroska:¶
Matroska:Matroska Reader:Matroska.¶Matroska Player:Matroska Reader with the primary purpose of playing audiovisual files, includingMatroska documents.¶Matroska Writer:Matroska documents.¶Matroska is a Document Type of EBML.This specification is dependent on the EBML Specification[RFC8794].For an understanding of Matroska's EBML Schema, see the following sections of[RFC8794] that coverEBML Element Types (Section 7 of [RFC8794]),EBML Schema (Section 11.1 of [RFC8794]),and EBML Structure (Section 3 of [RFC8794]).¶
Because of an oversight,[RFC8794] reserved EBML ID 0x80, which is used by deployed Matroska implementations.For this reason, this specification updates[RFC8794] to make 0x80 a legal EBML ID. Additionally, this specification makes the following updates:¶
Section 17.1 of [RFC8794] (per Errata 7189[Err7189])¶
OLD:¶
One-octet Element IDsMUST be between 0x81 and 0xFE. These items are valuable because they are short, and they need to be used for commonly repeated elements. Element IDs are to be allocated within this range according to the "RFC Required" policy[RFC8126].¶
The following one-octet Element IDs are RESERVED: 0xFF and 0x80.¶
NEW:¶
One-octet Element IDsMUST be between 0x80 and 0xFE. These items are valuable because they are short, and they need to be used for commonly repeated elements. Element IDs are to be allocated within this range according to the "RFC Required" policy[RFC8126].¶
The following one-octet Element ID is RESERVED: 0xFF.¶
Section 5 of [RFC8794] (per Errata 7191[Err7191])¶
OLD:¶
+=========================+================+=================+| Element ID Octet Length | Range of Valid | Number of Valid || | Element IDs | Element IDs |+=========================+================+=================+| 1 | 0x81 - 0xFE | 126 |+-------------------------+----------------+-----------------+¶
NEW:¶
+=========================+================+=================+| Element ID Octet Length | Range of Valid | Number of Valid || | Element IDs | Element IDs |+=========================+================+=================+| 1 | 0x80 - 0xFE | 127 |+-------------------------+----------------+-----------------+¶
As an EBML Document Type, Matroska adds the following constraints to the EBML specification:¶
The Root Element and all Top-Level ElementsMUST use 4 octets for their EBML Element ID -- i.e., Segment and direct children of Segment.¶
Legacy EBML / Matroska parsers did not handle Empty Elements properly. Elements were present in the file, but had a length of 0.They always assumed the value was 0 for integers/dates or 0x0p+0, the textual expression of floats using the[ISO9899] format, no matter the default value of the element which should have been used instead.Therefore, Matroska WritersMUST NOT use EBML Empty Elements, if the element has a default value that is not 0 for integers/dates and 0x0p+0 for floats.¶
When adding new elements to Matroska, these rules apply:¶
A Matroska fileMUST be composed of at least oneEBML Document using theMatroska Document Type.EachEBML DocumentMUST start with anEBML Header andMUST be followed by theEBML Root Element, defined as aSegment in Matroska. Matroska defines severalTop-Level Elementsthat may occur within theSegment.¶
As an example, a simple Matroska file consisting of a singleEBML Document could be represented like this:¶
A more complex Matroska file consisting of anEBML Stream (containing twoEBML Documents) could be represented like this:¶
The following diagram represents a simple Matroska file, comprised of anEBML Documentwith anEBML Header, aSegment Element (theRoot Element), and all eight MatroskaTop-Level Elements. In the following diagrams of this section, horizontal spacing expressesa parent-child relationship between Matroska Elements (e.g., theInfo Element is contained withintheSegment Element), whereas vertical alignment represents the storage order within the file.¶
+-------------+| EBML Header |+---------------------------+| Segment | SeekHead || |-------------|| | Info || |-------------|| | Tracks || |-------------|| | Chapters || |-------------|| | Cluster || |-------------|| | Cues || |-------------|| | Attachments || |-------------|| | Tags |+---------------------------+
The MatroskaEBML Schema defines eightTop-Level Elements:¶
SeekHead (Section 6.3)¶Info (Section 6.5)¶Tracks (Section 18)¶Chapters (Section 20)¶Cluster (Section 10)¶Cues (Section 22)¶Attachments (Section 21)¶Tags (Section 6.8)¶TheSeekHead Element (also known asMetaSeek) contains an index ofTop-Level Elementslocations within theSegment. Use of theSeekHead Element isRECOMMENDED. Without aSeekHead Element,a Matroska parser would have to search the entire file to find all of the otherTop-Level Elements.This is due to Matroska's flexible ordering requirements; for instance, it is acceptable fortheChapters Element to be stored after theCluster Element.¶
+--------------------------------+| SeekHead | Seek | SeekID || | |--------------|| | | SeekPosition |+--------------------------------+
SeekHead ElementTheInfo Element contains vital information for identifying the wholeSegment.This includes the title for theSegment, a randomly generated unique identifier (UID),and the UID(s) of any linkedSegment Elements.¶
+-------------------------+| Info | SegmentUUID || |------------------|| | SegmentFilename || |------------------|| | PrevUUID || |------------------|| | PrevFilename || |------------------|| | NextUUID || |------------------|| | NextFilename || |------------------|| | SegmentFamily || |------------------|| | ChapterTranslate || |------------------|| | TimestampScale || |------------------|| | Duration || |------------------|| | DateUTC || |------------------|| | Title || |------------------|| | MuxingApp || |------------------|| | WritingApp ||-------------------------|
Info Element and ItsChild ElementsTheTracks Element defines the technical details for each track and can store the name,number, UID, language, and type (audio, video, subtitles, etc.) of each track.For example, theTracks ElementMAY store information about the resolution of a video trackor a sample rate of an audio track.¶
TheTracks ElementMUST identify all the data needed by the codec to decode the data of thespecified track. However, the data required is contingent on the codec used for the track.For example, aTrack Element for uncompressed audio only requires the audio bit rate to be present.A codec such as AC-3 would require that theCodecID Element be present for all tracks,as it is the primary way to identify which codec to use to decode the track.¶
+------------------------------------+| Tracks | TrackEntry | TrackNumber || | |--------------|| | | TrackUID || | |--------------|| | | TrackType || | |--------------|| | | Name || | |--------------|| | | Language || | |--------------|| | | CodecID || | |--------------|| | | CodecPrivate || | |--------------|| | | CodecName || | |----------------------------------+| | | Video | FlagInterlaced || | | |-------------------|| | | | FieldOrder || | | |-------------------|| | | | StereoMode || | | |-------------------|| | | | AlphaMode || | | |-------------------|| | | | PixelWidth || | | |-------------------|| | | | PixelHeight || | | |-------------------|| | | | DisplayWidth || | | |-------------------|| | | | DisplayHeight || | | |-------------------|| | | | AspectRatioType || | | |-------------------|| | | | Color || | |----------------------------------|| | | Audio | SamplingFrequency || | | |-------------------|| | | | Channels || | | |-------------------|| | | | BitDepth ||--------------------------------------------------------|
Tracks Element and a Selection of ItsDescendant ElementsTheChapters Element lists all of the chapters. Chapters set predefinedpoints to jump to in video or audio.¶
+-----------------------------------------+| Chapters | Edition | EditionUID || | Entry |--------------------|| | | EditionFlagDefault || | |--------------------|| | | EditionFlagOrdered || | |---------------------------------+| | | ChapterAtom | ChapterUID || | | |-------------------|| | | | ChapterStringUID || | | |-------------------|| | | | ChapterTimeStart || | | |-------------------|| | | | ChapterTimeEnd || | | |-------------------|| | | | ChapterFlagHidden || | | |-------------------------------+| | | | ChapterDisplay | ChapString || | | | |--------------|| | | | | ChapLanguage |+------------------------------------------------------------------+
Chapters Element and a Selection of ItsDescendant ElementsCluster Elements contain the content for each track, e.g., video frames. A Matroska fileSHOULD contain at least oneCluster Element.In the rare case it doesn't, there should be a form of Segment linking with other Segments, possibly using Chapters, seeSection 17.¶
TheCluster Element helps to break upSimpleBlock orBlockGroup Elements and helps with seeking and error protection.EveryCluster ElementMUST contain aTimestamp Element.ThisSHOULD be theTimestamp Element used to play the firstBlock in theCluster Element,unless a different value is needed to accommodate for more Blocks; seeSection 11.2.¶
Cluster Elements contain one or more block element, such asBlockGroup orSimpleBlock elements.In some situations, aCluster ElementMAY contain no block element, e.g., in a live recordingwhen no data has been collected.¶
ABlockGroup ElementMAY contain aBlock of data and any information relating directly to thatBlock.¶
+--------------------------+| Cluster | Timestamp || |----------------|| | Position || |----------------|| | PrevSize || |----------------|| | SimpleBlock || |----------------|| | BlockGroup |+--------------------------+
Cluster Element and Its ImmediateChild Elements+----------------------------------+| Block | Portion of | Data Type || | a Block | - Bit Flag || |--------------------------+| | Header | TrackNumber || | |-------------|| | | Timestamp || | |-------------|| | | Flags || | | - Gap || | | - Lacing || | | - Reserved || |--------------------------|| | Optional | FrameSize || |--------------------------|| | Data | Frame |+----------------------------------+
Block Element StructureEachClusterMUST contain exactly oneTimestamp Element. TheTimestamp Element valueMUSTbe stored once perCluster. TheTimestamp Element in theCluster is relative to the entireSegment.TheTimestamp ElementSHOULD be the firstElement in theCluster it belongs to,or the secondElement if that Cluster contains a CRC-32 element (Section 6.2)¶
Additionally, theBlock contains an offset that, when added to theCluster'sTimestamp Element value,yields theBlock's effective timestamp. Therefore, the timestamp in theBlock itself is relative totheTimestamp Element in theCluster. For example, if theTimestamp Element in theClusteris set to 10 seconds and aBlock in thatCluster is supposed to be played 12 seconds into the clip,the timestamp in theBlock would be set to 2 seconds.¶
TheReferenceBlock in theBlockGroup is used instead of the basic "P-frame"/"B-frame" description.Instead of simply saying that thisBlock depends on theBlock directly before or directly after,theTimestamp of the necessaryBlock is used. Because there can be as manyReferenceBlock Elementsas necessary for aBlock, it allows for some extremely complex referencing.¶
TheCues Element is used to seek when playing back a file by providing a temporal indexfor some of theTracks. It is similar to theSeekHead Element, but is used for seeking toa specific time when playing back the file. It is possible to seek without this element,but it is much more difficult because aMatroska Reader would have to "hunt and peck"through the file to look for the correct timestamp.¶
TheCues ElementSHOULD contain at least oneCuePoint Element. EachCuePoint Elementstores the position of theCluster that contains theBlockGroup orSimpleBlock Element.The timestamp is stored in theCueTime Element and the location is stored in theCueTrackPositions Element.¶
TheCues Element is flexible. For instance, theCues Element can be used to index everysingle timestamp of everyBlock or they can be indexed selectively.¶
+-------------------------------------+| Cues | CuePoint | CueTime || | |-------------------|| | | CueTrackPositions || |------------------------------|| | CuePoint | CueTime || | |-------------------|| | | CueTrackPositions |+-------------------------------------+
Cues Element and Two Levels of ItsDescendant ElementsTheAttachments Element is for attaching files to a Matroska file, such as pictures,fonts, web pages, etc.¶
+------------------------------------------------+| Attachments | AttachedFile | FileDescription || | |-------------------|| | | FileName || | |-------------------|| | | FileMediaType || | |-------------------|| | | FileData || | |-------------------|| | | FileUID || | |-------------------|| | | FileName || | |-------------------|| | | FileReferral || | |-------------------|| | | FileUsedStartTime || | |-------------------|| | | FileUsedEndTime |+------------------------------------------------+
Attachments ElementTheTags Element contains metadata that describes theSegment and potentiallyitsTracks,Chapters, andAttachments. EachTrack orChapter that those tagsapplies to has its UID listed in theTags. TheTags contain all extra information aboutthe file: scriptwriters, singers, actors, directors, titles, edition, price, dates, genre, comments,etc. Tags can contain their values in multiple languages. For example, a movie's "title"Tagmight contain both the original English title as well as the German title.¶
+-------------------------------------------+| Tags | Tag | Targets | TargetTypeValue || | | |------------------|| | | | TargetType || | | |------------------|| | | | TagTrackUID || | | |------------------|| | | | TagEditionUID || | | |------------------|| | | | TagChapterUID || | | |------------------|| | | | TagAttachmentUID || | |------------------------------|| | | SimpleTag | TagName || | | |------------------|| | | | TagLanguage || | | |------------------|| | | | TagDefault || | | |------------------|| | | | TagString || | | |------------------|| | | | TagBinary || | | |------------------|| | | | SimpleTag |+-------------------------------------------+
Tags Element and Three Levels of ItsChildren ElementsThis specification includes anEBML Schema that defines the Elements and structureof Matroska using the EBML Schema elements and attributes defined inSection 11.1 of [RFC8794].The EBML Schema defines every valid Matroska element in a manner defined by the EBML specification.¶
Attributes using their default value, such asminOccurs,minver, etc., or attributes with undefined values, suchlength,maxver, etc., are omitted.¶
The definitions of each Matroska Element is provided below.¶
\Segment¶\Segment\SeekHead¶\Segment\SeekHead\Seek¶\Segment\SeekHead\Seek\SeekPosition¶\Segment\Info¶\Segment\Info\SegmentUUID¶\Segment\Info\PrevUUID¶\Segment\Info\PrevFilename¶\Segment\Info\NextUUID¶\Segment\Info\SegmentFamily¶ChapterTranslate element, this Element isREQUIRED.¶\Segment\Info\ChapterTranslate¶Segment and a Segment value in the given Chapter Codec.¶\Segment\Info\ChapterTranslate\ChapterTranslateID¶\Segment\Info\ChapterTranslate\ChapterTranslateCodec¶ChapterTranslate applies to this chapter codec of the given chapter edition(s); seeSection 5.1.7.1.4.15.¶| value | label | definition |
|---|---|---|
0 | Matroska Script | Chapter commands using the Matroska Script codec. |
1 | DVD-menu | Chapter commands using the DVD-like codec. |
\Segment\Info\ChapterTranslate\ChapterTranslateEditionUID¶ChapterTranslate applies.¶ChapterTranslateEditionUID is specified in theChapterTranslate, theChapterTranslate applies to all chapter editions found in the Segment using the givenChapterTranslateCodec.¶\Segment\Info\TimestampScale¶\Segment\Cluster¶\Segment\Cluster\Timestamp¶\Segment\Cluster\SimpleBlock¶\Segment\Cluster\BlockGroup¶\Segment\Cluster\BlockGroup\Block¶\Segment\Cluster\BlockGroup\BlockAdditions¶\Segment\Cluster\BlockGroup\BlockAdditions\BlockMore\BlockAddID¶\Segment\Cluster\BlockGroup\BlockDuration¶| attribute | note |
|---|---|
| minOccurs | BlockDurationMUST be set (minOccurs=1) if the associated TrackEntry stores a DefaultDuration value. |
| default | When not written and with no DefaultDuration, the value is assumed to be the difference between the timestamp of this Block and the timestamp of the next Block in "display" order (not coding order). |
\Segment\Cluster\BlockGroup\ReferencePriority¶\Segment\Cluster\BlockGroup\ReferenceBlock¶Block that thisBlock depends on.Historically, Matroska Writers didn't write the actualBlock(s) that thisBlock depends on; however, they did writesomeBlock(s) in the past.¶The value "0"MAY also be used to signify that thisBlock cannot be decoded on its own, but without knowledge of whichBlock is necessary. In this case, otherReferenceBlock ElementsMUST NOT be found in the sameBlockGroup.¶
If theBlockGroup doesn't have aReferenceBlock element, then theBlock it contains can be decoded without using any otherBlock data.¶
\Segment\Cluster\BlockGroup\DiscardPadding¶\Segment\Tracks¶\Segment\Tracks\TrackEntry¶\Segment\Tracks\TrackEntry\TrackType¶TrackType defines the type of each frame found in the Track.The valueSHOULD be stored on 1 octet.¶| value | label | contents of each frame |
|---|---|---|
1 | video | An image. |
2 | audio | Audio samples. |
3 | complex | A mix of different other TrackType. The codec needs to define how theMatroska Player should interpret such data. |
16 | logo | An image to be rendered over the video track(s). |
17 | subtitle | Subtitle or closed caption data to be rendered over the video track(s). |
18 | buttons | Interactive button(s) to be rendered over the video track(s). |
32 | control | Metadata used to control the player of theMatroska Player. |
33 | metadata | Timed metadata that can be passed on to theMatroska Player. |
\Segment\Tracks\TrackEntry\FlagForced¶\Segment\Tracks\TrackEntry\DefaultDuration¶\Segment\Tracks\TrackEntry\DefaultDecodedFieldDuration¶\Segment\Tracks\TrackEntry\TrackTimestampScale¶\Segment\Tracks\TrackEntry\MaxBlockAdditionID¶\Segment\Tracks\TrackEntry\BlockAdditionMapping¶\Segment\Tracks\TrackEntry\BlockAdditionMapping\BlockAddIDValue¶\Segment\Tracks\TrackEntry\BlockAdditionMapping\BlockAddIDType¶\Segment\Tracks\TrackEntry\BlockAdditionMapping\BlockAddIDExtraData¶\Segment\Tracks\TrackEntry\Language¶\Segment\Tracks\TrackEntry\CodecDelay¶\Segment\Tracks\TrackEntry\SeekPreRoll¶\Segment\Tracks\TrackEntry\TrackTranslate¶TrackEntry and a track value in the given Chapter Codec.¶\Segment\Tracks\TrackEntry\TrackTranslate\TrackTranslateTrackID¶TrackEntry in the chapter codec data.The format depends on theChapProcessCodecID used; seeSection 5.1.7.1.4.15.¶\Segment\Tracks\TrackEntry\TrackTranslate\TrackTranslateCodec¶TrackTranslate applies to this chapter codec of the given chapter edition(s); seeSection 5.1.7.1.4.15.¶| value | label | definition |
|---|---|---|
0 | Matroska Script | Chapter commands using the Matroska Script codec. |
1 | DVD-menu | Chapter commands using the DVD-like codec. |
\Segment\Tracks\TrackEntry\TrackTranslate\TrackTranslateEditionUID¶TrackTranslate applies.¶TrackTranslateEditionUID is specified in theTrackTranslate, theTrackTranslate applies to all chapter editions found in the Segment using the givenTrackTranslateCodec.¶\Segment\Tracks\TrackEntry\Video¶\Segment\Tracks\TrackEntry\Video\FlagInterlaced¶| value | label | definition |
|---|---|---|
0 | undetermined | Unknown status. This valueSHOULD be avoided. |
1 | interlaced | Interlaced frames. |
2 | progressive | No interlacing. |
\Segment\Tracks\TrackEntry\Video\FieldOrder¶| value | label | definition |
|---|---|---|
0 | progressive | Interlaced frames. This valueSHOULD be avoided; setting FlagInterlaced to 2 is sufficient. |
1 | tff | Top field displayed first. Top field stored first. |
2 | undetermined | Unknown field order. This valueSHOULD be avoided. |
6 | bff | Bottom field displayed first. Bottom field stored first. |
9 | bff(swapped) | Top field displayed first. Fields are interleaved in storage with the top line of the top field stored first. |
14 | tff(swapped) | Bottom field displayed first. Fields are interleaved in storage with the top line of the top field stored first. |
\Segment\Tracks\TrackEntry\Video\StereoMode¶| value | label |
|---|---|
0 | mono |
1 | side by side (left eye first) |
2 | top - bottom (right eye is first) |
3 | top - bottom (left eye is first) |
4 | checkboard (right eye is first) |
5 | checkboard (left eye is first) |
6 | row interleaved (right eye is first) |
7 | row interleaved (left eye is first) |
8 | column interleaved (right eye is first) |
9 | column interleaved (left eye is first) |
10 | anaglyph (cyan/red) |
11 | side by side (right eye first) |
12 | anaglyph (green/magenta) |
13 | both eyes laced in one Block (left eye is first) |
14 | both eyes laced in one Block (right eye is first) |
\Segment\Tracks\TrackEntry\Video\AlphaMode¶CodecID.Undefined valuesSHOULD NOT be used, as the behavior of known implementations is different (considered either as 0 or 1).¶| value | label | definition |
|---|---|---|
0 | none | The BlockAdditional Element with BlockAddID of "1" does not exist orSHOULD NOT be considered as containing such data. |
1 | present | The BlockAdditional Element with BlockAddID of "1" contains alpha channel data. |
\Segment\Tracks\TrackEntry\Video\OldStereoMode¶| value | label |
|---|---|
0 | mono |
1 | right eye |
2 | left eye |
3 | both eyes |
\Segment\Tracks\TrackEntry\Video\DisplayWidth¶| attribute | note |
|---|---|
| default | If the DisplayUnit of the same TrackEntry is 0, then the default value for DisplayWidth is equal to PixelWidth - PixelCropLeft - PixelCropRight; otherwise, there is no default value. |
\Segment\Tracks\TrackEntry\Video\DisplayHeight¶| attribute | note |
|---|---|
| default | If the DisplayUnit of the same TrackEntry is 0, then the default value for DisplayHeight is equal to PixelHeight - PixelCropTop - PixelCropBottom; otheriwse, there is no default value. |
\Segment\Tracks\TrackEntry\Video\UncompressedFourCC¶BITMAPINFO[AVIFormat]. There is neither a definitive list of FourCC values nor an official registry. Some common values for YUV pixel formats can be found at[MSYUV8],[MSYUV16], and[FourCC-YUV]. Some common values for uncompressed RGB pixel formats can be found at[MSRGB] and[FourCC-RGB].¶| attribute | note |
|---|---|
| minOccurs | UncompressedFourCCMUST be set (minOccurs=1) in the TrackEntry when the CodecID Element of the TrackEntry is set to "V_UNCOMPRESSED". |
\Segment\Tracks\TrackEntry\Video\Colour\MatrixCoefficients¶| value | label |
|---|---|
0 | Identity |
1 | ITU-R BT.709 |
2 | unspecified |
3 | reserved |
4 | US FCC 73.682 |
5 | ITU-R BT.470BG |
6 | SMPTE 170M |
7 | SMPTE 240M |
8 | YCoCg |
9 | BT2020 Non-constant Luminance |
10 | BT2020 Constant Luminance |
11 | SMPTE ST 2085 |
12 | Chroma-derived Non-constant Luminance |
13 | Chroma-derived Constant Luminance |
14 | ITU-R BT.2100-0 |
\Segment\Tracks\TrackEntry\Video\Colour\ChromaSubsamplingHorz¶\Segment\Tracks\TrackEntry\Video\Colour\ChromaSubsamplingVert¶\Segment\Tracks\TrackEntry\Video\Colour\CbSubsamplingHorz¶\Segment\Tracks\TrackEntry\Video\Colour\ChromaSitingHorz¶| value | label |
|---|---|
0 | unspecified |
1 | left collocated |
2 | half |
\Segment\Tracks\TrackEntry\Video\Colour\ChromaSitingVert¶| value | label |
|---|---|
0 | unspecified |
1 | top collocated |
2 | half |
\Segment\Tracks\TrackEntry\Video\Colour\Range¶| value | label |
|---|---|
0 | unspecified |
1 | broadcast range |
2 | full range (no clipping) |
3 | defined by MatrixCoefficients / TransferCharacteristics |
\Segment\Tracks\TrackEntry\Video\Colour\TransferCharacteristics¶| value | label |
|---|---|
0 | reserved |
1 | ITU-R BT.709 |
2 | unspecified |
3 | reserved2 |
4 | Gamma 2.2 curve - BT.470M |
5 | Gamma 2.8 curve - BT.470BG |
6 | SMPTE 170M |
7 | SMPTE 240M |
8 | Linear |
9 | Log |
10 | Log Sqrt |
11 | IEC 61966-2-4 |
12 | ITU-R BT.1361 Extended Colour Gamut |
13 | IEC 61966-2-1 |
14 | ITU-R BT.2020 10 bit |
15 | ITU-R BT.2020 12 bit |
16 | ITU-R BT.2100 Perceptual Quantization |
17 | SMPTE ST 428-1 |
18 | ARIB STD-B67 (HLG) |
\Segment\Tracks\TrackEntry\Video\Colour\Primaries¶| value | label |
|---|---|
0 | reserved |
1 | ITU-R BT.709 |
2 | unspecified |
3 | reserved2 |
4 | ITU-R BT.470M |
5 | ITU-R BT.470BG - BT.601 625 |
6 | ITU-R BT.601 525 - SMPTE 170M |
7 | SMPTE 240M |
8 | FILM |
9 | ITU-R BT.2020 |
10 | SMPTE ST 428-1 |
11 | SMPTE RP 432-2 |
12 | SMPTE EG 432-2 |
22 | EBU Tech. 3213-E - JEDEC P22 phosphors |
\Segment\Tracks\TrackEntry\Video\Projection\ProjectionType¶| value | label |
|---|---|
0 | rectangular |
1 | equirectangular |
2 | cubemap |
3 | mesh |
\Segment\Tracks\TrackEntry\Video\Projection\ProjectionPrivate¶Private data that only applies to a specific projection.¶
ProjectionType equals 0 (rectangular), then this elementMUST NOT be present.¶ProjectionType equals 1 (equirectangular), then this elementMUST be present and contain the same binary data that would be stored inside an ISOBMFF Equirectangular Projection Box ("equi").¶ProjectionType equals 2 (cubemap), then this elementMUST be present and contain the same binary data that would be stored inside an ISOBMFF Cubemap Projection Box ("cbmp").¶ProjectionType equals 3 (mesh), then this elementMUST be present and contain the same binary data that would be stored inside an ISOBMFF Mesh Projection Box ("mshp").¶\Segment\Tracks\TrackEntry\Video\Projection\ProjectionPoseYaw¶Value represents a clockwise rotation, in degrees, around the up vector. This rotation must be appliedbefore anyProjectionPosePitch orProjectionPoseRoll rotations.The value of this elementMUST be in the -180 to 180 degree range, both included.¶
SettingProjectionPoseYaw to -180 or 180 degrees with theProjectionPoseRoll andProjectionPosePitch set to 0 degrees flips the image horizontally.¶
\Segment\Tracks\TrackEntry\Video\Projection\ProjectionPosePitch¶Value represents a counter-clockwise rotation, in degrees, around the right vector. This rotation must be appliedafter theProjectionPoseYaw rotation and before theProjectionPoseRoll rotation.The value of this elementMUST be in the -90 to 90 degree range, both included.¶
\Segment\Tracks\TrackEntry\Video\Projection\ProjectionPoseRoll¶Value represents a counter-clockwise rotation, in degrees, around the forward vector. This rotation must be appliedafter theProjectionPoseYaw andProjectionPosePitch rotations.The value of this elementMUST be in the -180 to 180 degree range, both included.¶
SettingProjectionPoseRoll to -180 or 180 degrees andProjectionPoseYaw to 180 or -180 degrees withProjectionPosePitch set to 0 degrees flips the image vertically.¶
SettingProjectionPoseRoll to 180 or -180 degrees withProjectionPoseYaw andProjectionPosePitch set to 0 degrees flips the image horizontally and vertically.¶
\Segment\Tracks\TrackEntry\Audio¶\Segment\Tracks\TrackEntry\Audio\OutputSamplingFrequency¶| attribute | note |
|---|---|
| default | The default value for OutputSamplingFrequency of the same TrackEntry is equal to the SamplingFrequency. |
\Segment\Tracks\TrackEntry\TrackOperation¶\Segment\Tracks\TrackEntry\TrackOperation\TrackCombinePlanes\TrackPlane\TrackPlaneType¶| value | label |
|---|---|
0 | left eye |
1 | right eye |
2 | background |
\Segment\Tracks\TrackEntry\ContentEncodings¶\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncodingOrder¶ContentEncoding of theContentEncodings.The decoder/demuxerMUST start with theContentEncoding with the highestContentEncodingOrder and work its way down to theContentEncoding with the lowestContentEncodingOrder.This valueMUST be unique over for eachContentEncoding found in theContentEncodings of thisTrackEntry.¶\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncodingScope¶| value | label | definition |
|---|---|---|
1 | Block | All frame contents excluding lacing data. |
2 | Private | The track'sCodecPrivate data. |
4 | Next | The next ContentEncoding (nextContentEncodingOrder; either the data insideContentCompression and/orContentEncryption). This valueSHOULD NOT be used, as it's not supported by players. |
\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncodingType¶| value | label |
|---|---|
0 | Compression |
1 | Encryption |
\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentCompression¶\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentCompression\ContentCompAlgo¶| value | label | definition |
|---|---|---|
0 | zlib | zlib compression[RFC1950] |
1 | bzlib | bzip2 compression[BZIP2],SHOULD NOT be used; see usage notes. |
2 | lzo1x | Lempel-Ziv-Oberhumer compression[LZO],SHOULD NOT be used; see usage notes. |
3 | Header Stripping | Octets inContentCompSettings (Section 5.1.4.1.31.7) have been stripped from each frame. |
\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentCompression\ContentCompSettings¶ContentCompAlgo=3),the bytes that were removed from the beginning of each frames of the track.¶\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncryption¶ContentEncodingType is 1 (encryption) andMUST be ignored otherwise.A Matroska PlayerMAY support encryption.¶\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncryption\ContentEncAlgo¶| value | label | definition |
|---|---|---|
0 | Not encrypted | The data is not encrypted. |
1 | DES | Data Encryption Standard (DES)[FIPS46-3]. This valueSHOULD be avoided. |
2 | 3DES | Triple Data Encryption Algorithm[SP800-67]. This valueSHOULD be avoided. |
3 | Twofish | Twofish Encryption Algorithm[Twofish]. |
4 | Blowfish | Blowfish Encryption Algorithm[Blowfish]. This valueSHOULD be avoided. |
5 | AES | Advanced Encryption Standard (AES)[FIPS197]. |
\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncryption\ContentEncAESSettings¶| attribute | note |
|---|---|
| maxOccurs | ContentEncAESSettingsMUST NOT be set (maxOccurs=0) if ContentEncAlgo is not AES (5). |
\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncryption\ContentEncAESSettings\AESSettingsCipherMode¶| value | label | definition |
|---|---|---|
1 | AES-CTR | Counter[SP800-38A]. |
2 | AES-CBC | Cipher Block Chaining[SP800-38A]. |
| attribute | note |
|---|---|
| maxOccurs | AESSettingsCipherModeMUST NOT be set (maxOccurs=0) if ContentEncAlgo is not AES (5). |
\Segment\Cues¶| attribute | note |
|---|---|
| minOccurs | This ElementSHOULD be set when the Segment is not transmitted as a live stream; seeSection 23.2. |
\Segment\Cues\CuePoint¶\Segment\Cues\CuePoint\CueTime¶\Segment\Cues\CuePoint\CueTrackPositions¶\Segment\Cues\CuePoint\CueTrackPositions\CueClusterPosition¶\Segment\Cues\CuePoint\CueTrackPositions\CueDuration¶\Segment\Attachments¶\Segment\Chapters¶\Segment\Chapters\EditionEntry¶\Segment\Chapters\EditionEntry\+ChapterAtom¶\Segment\Chapters\EditionEntry\+ChapterAtom\ChapterTimeStart¶\Segment\Chapters\EditionEntry\+ChapterAtom\ChapterTimeEnd¶ChapterTimeStart of the sameChapterAtom.¶ChapterTimeEnd timestamp value being excluded, itMUST take into account the duration ofthe last frame it includes, especially for theChapterAtom using the last frames of theSegment.¶| attribute | note |
|---|---|
| minOccurs | ChapterTimeEndMUST be set (minOccurs=1) if the Edition is an ordered edition; seeSection 20.1.3. If it's aParent Chapter, seeSection 20.2.3. |
\Segment\Chapters\EditionEntry\+ChapterAtom\ChapterFlagHidden¶\Segment\Chapters\EditionEntry\+ChapterAtom\ChapterSegmentUUID¶SegmentUUID value of theSegment it belongs to.¶| attribute | note |
|---|---|
| minOccurs | ChapterSegmentUUIDMUST be set (minOccurs=1) if ChapterSegmentEditionUID is used; seeSection 17.2 on Medium-Linking Segments. |
\Segment\Chapters\EditionEntry\+ChapterAtom\ChapterSegmentEditionUID¶\Segment\Chapters\EditionEntry\+ChapterAtom\ChapterPhysicalEquiv¶\Segment\Chapters\EditionEntry\+ChapterAtom\ChapterDisplay\ChapLanguage¶\Segment\Chapters\EditionEntry\+ChapterAtom\ChapterDisplay\ChapLanguageBCP47¶\Segment\Chapters\EditionEntry\+ChapterAtom\ChapterDisplay\ChapCountry¶\Segment\Chapters\EditionEntry\+ChapterAtom\ChapProcess\ChapProcessCodecID¶\Segment\Chapters\EditionEntry\+ChapterAtom\ChapProcess\ChapProcessPrivate¶\Segment\Chapters\EditionEntry\+ChapterAtom\ChapProcess\ChapProcessCommand\ChapProcessTime¶| value | label |
|---|---|
0 | during the whole chapter |
1 | before starting playback |
2 | after playback of the chapter |
\Segment\Chapters\EditionEntry\+ChapterAtom\ChapProcess\ChapProcessCommand\ChapProcessData¶\Segment\Tags¶\Segment\Tags\Tag¶\Segment\Tags\Tag\Targets¶\Segment\Tags\Tag\Targets\TargetTypeValue¶| value | label | definition |
|---|---|---|
70 | COLLECTION | The highest hierarchical level that tags can describe. |
60 | EDITION / ISSUE / VOLUME / OPUS / SEASON / SEQUEL | A list of lower levels grouped together. |
50 | ALBUM / OPERA / CONCERT / MOVIE / EPISODE | The most common grouping level of music and video (equal to an episode for TV series). |
40 | PART / SESSION | When an album or episode has different logical parts. |
30 | TRACK / SONG / CHAPTER | The common parts of an album or movie. |
20 | SUBTRACK / MOVEMENT / SCENE | Corresponds to parts of a track for audio, such as a movement or scene in a movie. |
10 | SHOT | The lowest hierarchy found in music or movies. |
\Segment\Tags\Tag\Targets\TargetType¶| value | label |
|---|---|
COLLECTION | TargetTypeValue 70 |
EDITION | TargetTypeValue 60 |
ISSUE | TargetTypeValue 60 |
VOLUME | TargetTypeValue 60 |
OPUS | TargetTypeValue 60 |
SEASON | TargetTypeValue 60 |
SEQUEL | TargetTypeValue 60 |
ALBUM | TargetTypeValue 50 |
OPERA | TargetTypeValue 50 |
CONCERT | TargetTypeValue 50 |
MOVIE | TargetTypeValue 50 |
EPISODE | TargetTypeValue 50 |
PART | TargetTypeValue 40 |
SESSION | TargetTypeValue 40 |
TRACK | TargetTypeValue 30 |
SONG | TargetTypeValue 30 |
CHAPTER | TargetTypeValue 30 |
SUBTRACK | TargetTypeValue 20 |
MOVEMENT | TargetTypeValue 20 |
SCENE | TargetTypeValue 20 |
SHOT | TargetTypeValue 10 |
\Segment\Tags\Tag\Targets\TagTrackUID¶TrackUID value of a track found in this Segment.¶\Segment\Tags\Tag\Targets\TagEditionUID¶EditionUID value of an edition found in this Segment.¶\Segment\Tags\Tag\Targets\TagChapterUID¶ChapterUID value of a chapter found in this Segment.¶\Segment\Tags\Tag\Targets\TagAttachmentUID¶FileUID value of an attachment found in this Segment.¶\Segment\Tags\Tag\+SimpleTag¶\Segment\Tags\Tag\+SimpleTag\TagLanguage¶With the exceptions of theEBML Header and theCRC-32 Element, the EBML specification does notrequire any particular storage order forElements. However, this specification defines, mandates, and recommends the order ofcertainElements to facilitate better playback, seeking, and editingefficiency. This section describes and offers rationale for orderingrequirements and recommendations for Matroska.¶
TheInfo Element is the onlyREQUIREDTop-Level Element in a Matroska file.To be playable, MatroskaMUST also contain at least oneTracks Element andCluster Element.The firstInfo Element and the firstTracks ElementMUST either be stored before the firstCluster Element or bothSHALL be referenced by aSeekHead Element occurring before the firstCluster Element.¶
AllTop-Level ElementsMUST use an EBML Element ID that is 4 octets long.¶
When using Medium Linking, chapters are used to reference other Segments to play in a given orderSection 17.2.A Segment containing these Linked Chapters does not require aTrack Element or aCluster Element.¶
It is possible to edit a Matroska file after it has been created. For example, chapters,tags, or attachments can be added. When newTop-Level Elements are added to a Matroska file,theSeekHead Element(s)MUST be updated so that theSeekHead Element(s) itemizethe identity and position of allTop-Level Elements.¶
Editing, removing, or addingElements to a Matroska file often requires that some existingElements be voidedor extended.Transforming the existingElements intoVoid Elements as padding can be usedas a method to avoid moving large amounts of data around.¶
As noted by the EBML specification, if aCRC-32 Element is used, then theCRC-32 ElementMUST be the first orderedElement within itsParent Element.¶
In Matroska, allTop-Level Elements of an EBML DocumentSHOULD include aCRC-32 Elementas their firstChild Element.TheSegment Element, which is theRoot Element,SHOULD NOT have aCRC-32 Element.¶
If used, the firstSeekHead ElementMUST be the first non-CRC-32 Child Elementof theSegment Element. If a secondSeekHead Element is used, then the firstSeekHead ElementMUST reference the identity and position of the secondSeekHead Element.¶
Additionally, the secondSeekHead ElementMUST only referenceCluster Elementsand not any otherTop-Level Element already contained within the firstSeekHead Element.¶
The secondSeekHead ElementMAY be stored in any order relative to the otherTop-Level Elements.Whether one or twoSeekHead Element(s) are used, theSeekHead Element(s)MUSTcollectively reference the identity and position of allTop-Level Elements exceptfor the firstSeekHead Element.¶
TheCues Element isRECOMMENDED to optimize seeking access in Matroska. It isprogrammatically simpler to add theCues Element after allCluster Elementshave been written because this does not require a prediction of how much space toreserve before writing theCluster Elements. However, storing theCues Elementbefore theCluster Elements can provide some seeking advantages. If theCues Elementis present, then itSHOULD either be stored before the firstCluster Elementor be referenced by aSeekHead Element.¶
The firstInfo ElementSHOULD occur before the firstTracks Element and firstCluster Element except when it is referenced by aSeekHead Element.¶
TheChapters ElementSHOULD be placed before theCluster Element(s). TheChapters Element can be used during playback even if the user does not need to seek.It immediately gives the user information about what section is being read and whatother sections are available. In the case of Ordered Chapters, it isRECOMMENDED to evaluatethe logical linking even before playing. TheChapters ElementSHOULD be placed beforethe firstTracks Element and after the firstInfo Element.¶
TheAttachments Element is not intended to be used by default when playing the file,but could contain information relevant to the content, such as cover art or fonts.Cover art is useful even before the file is played and fonts could be needed before playbackstarts for the initialization of subtitles. TheAttachments ElementMAY be placed beforethe firstCluster Element; however, if theAttachments Element is likely to be edited,then itSHOULD be placed after the lastCluster Element.¶
TheTags Element is most subject to changes after the file was originally created.For easier editing, theTags Element can be placed at the end of theSegment Elementand after theAttachments Element. On the other hand, it is inconvenient to have toseek in theSegment for tags, especially for network streams; thus, it's better if theTags Element is found early in the stream. When editing theTags Element, the originalTags Element at the beginning can be overwritten with aVoid Element and anewTags Element written at the end of theSegment Element. The file and Segment sizes will only marginally change.¶
Matroska is based on the principle that a reading application does not have to support100% of the specifications in order to be able to play the file. Therefore, a Matroska file contains version indicators that tell a reading application what to expect.¶
It is possible and valid to have the version fields indicate that the file containsMatroskaElements from a higher specification version number while signaling that areading applicationMUST only support a lower version number properly in order to playit back (possibly with a reduced feature set).¶
TheEBML Header of each Matroska document informs the reading application on whatversion of Matroska to expect. TheElements within theEBML Header with jurisdictionover this information areDocTypeVersion andDocTypeReadVersion.¶
DocTypeVersionMUST be equal to or greater than the highest Matroska version number ofanyElement present in the Matroska file. For example, a file using theSimpleBlock Element (Section 5.1.3.4)MUST have aDocTypeVersion equal to or greater than 2. A file containingCueRelativePositionElements (Section 5.1.5.1.2.3)MUST have aDocTypeVersion equal to or greater than 4.¶
TheDocTypeReadVersionMUST contain the minimum version number that a reading applicationcan minimally support in order to play the file back -- optionally with a reduced featureset. For example, if a file contains onlyElements of version 2 or lower except forCueRelativePosition (which is a version 4 MatroskaElement), thenDocTypeReadVersionSHOULD still be set to 2 and not 4 because evaluatingCueRelativePosition is notnecessary for standard playback -- it makes seeking more precise if used.¶
A reading application supporting Matroska versionVMUST NOT refuse to read afile withDocReadTypeVersion equal to or lower thanV, even ifDocTypeVersionis greater thanV.¶
A reading applicationsupporting Matroska versionV at minimum and reading a file whoseDocTypeReadVersionfield is equal to or lower thanVMUST skip Matroska / EBMLElements it encountersbut does not know about if that unknown element fits into the size constraints setby the currentParent Element.¶
It is sometimes necessary to create a Matroska file from another Matroska file; e.g., to add subtitles in a languageor to edit out a portion of the content.Some values from the original Matroska file need to be kept the same in the destination file.For example, the SamplingFrequency of an audio track wouldn't change between the two files.Some other values may change between the two files, such as the TrackNumber of an audio track when another track has been added.¶
An Element is marked with the property "stream copy: True" when the values of that Element need to be kept identical between the source and destination files.If that property is not set, elements may or may not keep the same value between the source and destination files.¶
TheDefaultDecodedFieldDuration Element can signal to the displaying application howoften fields of a video sequence will be available for displaying. It can be used for bothinterlaced and progressive content.¶
If the video sequence is signaled as interlacedSection 5.1.4.1.28.1, thenDefaultDecodedFieldDuration equalsthe period between two successive fields at the output of the decoding process.For video sequences signaled as progressive,DefaultDecodedFieldDuration is half ofthe period between two successive frames at the output of the decoding process.¶
These values are valid at the end of the decoding process before post-processing(such as deinterlacing or inverse telecine) is applied.¶
Examples:¶
Frames using referencesSHOULD be stored in "coding order", i.e., storing the references first and thenthe frames referencing them. A consequence is that timestamps might not be consecutive.However, a frame with a past timestampMUST reference a frame already known. Otherwise, the frame is considered bad/void.¶
Matroska has two similar ways to store frames in a block:¶
Block, which is contained inside aBlockGroup.¶SimpleBlock, which is directly in theCluster.¶TheSimpleBlock is usually preferred unless some extra elements of theBlockGroup need to be used.A Matroska ReaderMUST support both types of blocks.¶
Each block contains the same parts in the following order:¶
The block header starts with the number of the Track it corresponds to.The valueMUST correspond to theTrackNumber (Section 5.1.4.1.1) of aTrackEntry of theSegment.¶
TheTrackNumber is coded using the Variable-Size Integer (VINT) mechanism described inSection 4 of [RFC8794].To save space, the shortest VINT formSHOULD be used. The value can be coded on up to 8 octets.This is the only element with a variable size in the block header.¶
The timestamp is expressed in Track Ticks; seeSection 11.1.The value is stored as a signed value on 16 bits.¶
This section describes the binary data contained in theBlock Element (Section 5.1.3.5.1). Bit 0 is the most significant bit.¶
As theTrackNumber size can vary between 1 and 8 octets, there are 8 different sizes for theBlock header.The definitions forTrackNumber sizes of 1 and 2 are provided; the other variants can be deduced by extending the size of theTrackNumber by multiples of 8 bits.¶
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| | | |I|LAC|U|| Track Number | Timestamp | Rsvrd |N|ING|N|| | | |V| |U|+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Track Number | Timestamp |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| |I|LAC|U|| Rsvrd |N|ING|N| ...| |V| |U|+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
where:¶
2 bits. Uses lacing mode.¶
The following data in theBlock corresponds to the lacing data and frames usage as described in each respective lacing mode.¶
This section describes the binary data contained in theSimpleBlock Element (Section 5.1.3.4). Bit 0 is the most significant bit.¶
TheSimpleBlock structure is inspired by the Block structure; seeSection 10.1.The main differences are the added Keyframe flag and Discardable flag. Otherwise, everything is the same.¶
As theTrackNumber size can vary between 1 and 8 octets, there are 8 different sizes for theSimpleBlock header.The definitions forTrackNumber sizes of 1 and 2 are provided; the other variants can be deduced by extending the size of theTrackNumber by multiples of 8 bits.¶
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| | |K| |I|LAC|D|| Track Number | Timestamp |E|Rsvrd|N|ING|I|| | |Y| |V| |S|+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+| Track Number | Timestamp |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+|K| |I|LAC|D||E|Rsvrd|N|ING|I| ...|Y| |V| |S|+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
where:¶
2 bits. Uses lacing mode.¶
The following data in theSimpleBlock correspond to the lacing data and frames usage as described in each respective lacing mode.¶
Lacing is a mechanism to save space when storing data. It is typically used for small blocksof data (referred to as frames in Matroska). It packs multiple frames into a singleBlock orSimpleBlock.¶
LacingMUST NOT be used to store a single frame in aBlock orSimpleBlock.¶
There are three types of lacing:¶
When lacing is not used, i.e., to store a single frame, lacing bits 5 and 6 of theBlock orSimpleBlockMUST be set to 0.¶
For example, a user wants to store 3 frames of the same track. The first frame is 800 octets long,the second is 500 octets long, and the third is 1000 octets long. Since these frames are small,they can be stored in a lace to save space.¶
It is possible to not use lacing at all and just store a single frame without any extra data.When the FlagLacing (Section 5.1.4.1.12) is set to "0", all blocks of that trackMUST NOT use lacing.¶
When no lacing is used, the number of frames in the lace is ommitted and only one frame can be stored in the Block.Bits 5 and 6 of the Block Header flags are set to0b00.¶
The Block for an 800-octet frame is as follows:¶
When a Block contains a single frame, itMUST use this No lacing mode.¶
The Xiph lacing uses the same coding of size as found in the Ogg container[RFC3533].Bits 5 and 6 of the Block Header flags are set to0b01.¶
The Block data with laced frames is stored as follows:¶
The lacing size is split into 255 values, stored as unsigned octets -- for example, 500 is coded 255;245 or [0xFF 0xF5].A frame with a size multiple of 255 is coded with a 0 at the end of the size -- for example, 765 is coded 255;255;255;0 or [0xFF 0xFF 0xFF 0x00].¶
The size of the last frame is deduced from the size remaining in the Block after the other frames.¶
Because large sizes result in large coding of the sizes, it isRECOMMENDED to use Xiph lacing only with small frames.¶
In our example, the 800, 500, and 1000-octet frames are stored with Xiph lacing in a Block as follows:¶
| Block Octets | Value | Description |
|---|---|---|
| 4 | 0x02 | Number of frames minus 1 |
| 5-8 | 0xFF 0xFF 0xFF 0x23 | Size of the first frame (255; 255; 255; 35) |
| 9-10 | 0xFF 0xF5 | Size of the second frame (255; 245) |
| 11-810 | First frame data | |
| 811-1310 | Second frame data | |
| 1311-2310 | Third frame data |
The Block is 2311 octets and the last frame starts at 1311, so we can deduce that the size of the last frame is 2311 - 1311 = 1000.¶
The EBML lacing encodes the frame size with an EBML-like encoding[RFC8794].Bits 5 and 6 of the Block Header flags are set to0b11.¶
The Block data with laced frames is stored as follows:¶
The first frame size is encoded as an EBML VINT value.The remaining frame sizes are encoded as signed values using the difference between the frame size and the previous frame size.These signed values are encoded as VINT with a mapping from signed to unsigned numbers.Decoding the unsigned number stored in the VINT to a signed number is done by subtracting 2((7*n)-1)-1, wheren is the octet size of the VINT.¶
| Bit Representation of Signed VINT | Possible Value Range |
|---|---|
| 1xxx xxxx | 2^7 values from -(26-1) to 26 |
| 01xx xxxx xxxx xxxx | 2^14 values from -(213-1) to 213 |
| 001x xxxx xxxx xxxx xxxx xxxx | 2^21 values from -(220-1) to 220 |
| 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx | 2^28 values from -(227-1) to 227 |
| 0000 1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx | 2^35 values from -(234-1) to 234 |
In our example, the 800, 500 and 1000-octet frames are stored with EBML lacing in a Block as follows:¶
| Block Octets | Value | Description |
|---|---|---|
| 4 | 0x02 | Number of frames minus 1 |
| 5-6 | 0x43 0x20 | Size of the first frame (800 = 0x320 + 0x4000) |
| 7-8 | 0x5E 0xD3 | Size of the second frame (500 - 800 = -300 = - 0x12C + 0x1FFF + 0x4000) |
| 8-807 | <frame1> | First frame data |
| 808-1307 | <frame2> | Second frame data |
| 1308-2307 | <frame3> | Third frame data |
The Block is 2308 octets and the last frame starts at 1308, so we can deduce that the size of the last frame is 2308 - 1308 = 1000.¶
Fixed-size lacing doesn't store the frame size; rather, it only stores the number of frames in the lace.Each frameMUST have the same size. The frame size of each frame is deduced from the total size of the Block.Bits 5 and 6 of the Block Header flags are set to0b10.¶
The Block data with laced frames is stored as follows:¶
For example, for three frames that are 800 octets each:¶
| Block Octets | Value | Description |
|---|---|---|
| 4 | 0x02 | Number of frames minus 1 |
| 5-804 | <frame1> | First frame data |
| 805-1604 | <frame2> | Second frame data |
| 1605-2404 | <frame3> | Third frame data |
This gives a Block of 2405 octets. When reading the Block, we find that there are three frames (Octet 4).The data start at Octet 5, so the size of each frame is (2405 - 5) / 3 = 800.¶
A Block only contains a single timestamp value. But when lacing is used, it contains more than one frame.Each frame originally has its own timestamp, or Presentation Timestamp (PTS). That timestamp applies tothe first frame in the lace.¶
In the lace, each frame after the first one has an underdetermined timestamp.However, each of these framesMUST be contiguous, i.e., the decoded dataMUST NOT contain any gapbetween them. If there is a gap in the stream, the frames around the gapMUST NOT be in the same Block.¶
Lacing is only useful for small contiguous data to save space. This is usually the case for audio tracksand not the case for video (which use a lot of data) or subtitle tracks (which have long gaps).For audio, there is usually a fixed output sampling frequency for the whole track,so the decoder should be able to recover the timestamp of each sample knowing eachoutput sample is contiguous with a fixed frequency.For subtitles, this is usually not the case; therefore, lacingSHOULD NOT be used.¶
Random Access Points (RAPs) are positions where the parser can seek to and start playback without decodingof what was before. In Matroska,BlockGroups andSimpleBlocks can be RAPs.To seek to these elements, it is still necessary to seek to theCluster containing them,read the Cluster Timestamp,and start playback from theBlockGroup orSimpleBlock that is a RAP.¶
Because a Matroska File is usually composed of multiple tracks playing at the same time-- video, audio and subtitles -- to seek properly to a RAP, each selected track must betaken in account. Usually, all audio and subtitleBlockGroups orSimpleBlocks are RAPs.They are independent of each other and can be played randomly.¶
On the other hand, video tracks often use references to previous and future frames for bettercoding efficiency. Frames with such referencesMUST either contain one or moreReferenceBlock Elements in theirBlockGroup orMUST be markedas non-keyframe in aSimpleBlock; seeSection 10.2.¶
<Cluster> <Timestamp>123456</Timestamp> <BlockGroup> <!-- References a Block 40 Track Ticks before this one --> <ReferenceBlock>-40</ReferenceBlock> <Block/> </BlockGroup> ...</Cluster>¶
<Cluster> <Timestamp>123456</Timestamp> <SimpleBlock/> (octet 3 bit 0 not set) ...</Cluster>¶
Frames that are RAPs (i.e., frames that don't depend on other frames)MUST set the keyframeflag if they are in aSimpleBlock or their parentBlockGroupMUST NOT containaReferenceBlock.¶
<Cluster> <Timestamp>123456</Timestamp> <BlockGroup> <!-- No ReferenceBlock allowed in this BlockGroup --> <Block/> </BlockGroup> ...</Cluster>¶
<Cluster> <Timestamp>123456</Timestamp> <SimpleBlock/> (octet 3 bit 0 set) ...</Cluster>¶
There may be cases where the use ofBlockGroup is necessary, as the frame may need aBlockDuration,BlockAdditions,CodecState, orDiscardPadding element.For thoses cases, aSimpleBlockMUST NOT be used; rather,the reference informationSHOULD be recovered for non-RAP frames.¶
<Cluster> <Timestamp>123456</Timestamp> <SimpleBlock/> (octet 3 bit 0 not set) ...</Cluster>¶
BlockDuration, with the EBML tree shown as XML:¶<Cluster> <Timestamp>123456</Timestamp> <BlockGroup> <!-- ReferenceBlock value recovered based on the codec --> <ReferenceBlock>-40</ReferenceBlock> <BlockDuration>20</BlockDuration> <Block/> </BlockGroup> ...</Cluster>¶
When a frame in aBlockGroup is not a RAP, theBlockGroupMUST contain at least aReferenceBlock.TheReferenceBlocksMUST be used in one of the following ways:¶
ReferenceBlock;¶ReferenceBlock, even if the timestamp value is accurate; or¶ReferenceBlock with the timestamp value "0" corresponding to a self or unknown reference.¶The lack ofReferenceBlock would mean such a frame is a RAP and seeking on thatframe that actually depends on other frames may create a bogus output or even crash.¶
<Cluster> <Timestamp>123456</Timestamp> <BlockGroup> <!-- ReferenceBlock value not recovered from the codec --> <ReferenceBlock>0</ReferenceBlock> <BlockDuration>20</BlockDuration> <Block/> </BlockGroup> ...</Cluster>¶
<Cluster> <Timestamp>123456</Timestamp> <BlockGroup> <!-- References a Block 80 Track Ticks before this one --> <ReferenceBlock>-80</ReferenceBlock> <!-- References a Block 40 Track Ticks after this one --> <ReferenceBlock>40</ReferenceBlock> <Block/> </BlockGroup> ...</Cluster>¶
Intra-only video frames, such as the ones found in AV1 or VP9, can be decoded without any otherframe, but they don't reset the codec state. Thus, seeking to these frames is not possible,as the next frames may need frames that are not known from this seeking point.Such intra-only framesMUST NOT be considered as keyframes, so the keyframe flagMUST NOT be set in theSimpleBlock or aReferenceBlockMUST be usedto signify the frame is not a RAP. The timestamp value of theReferenceBlockMUSTbe "0", meaning it's referencing itself.¶
<Cluster> <Timestamp>123456</Timestamp> <BlockGroup> <!-- References itself to mark it should not be used as RAP --> <ReferenceBlock>0</ReferenceBlock> <Block/> </BlockGroup> ...</Cluster>¶
Because a videoSimpleBlock has less information on references than a videoBlockGroup,it is possible to remux a video track usingBlockGroup into aSimpleBlockas long as it doesn't use any otherBlockGroup features thanReferenceBlock.¶
Historically, timestamps in Matroska were mistakenly called timecodes. TheTimestamp Elementwas called Timecode, theTimestampScale Element was called TimecodeScale, theTrackTimestampScale Element was called TrackTimecodeScale, and theReferenceTimestamp Element was called ReferenceTimeCode.¶
All timestamp values in Matroska are expressed in multiples of a tick.They are usually stored as integers.There are three types of ticks possible: Matroska Ticks, Segment Ticks, and Track Ticks.¶
For such elements, the timestamp value is stored directly in nanoseconds.¶
The elements storing values in Matroska Ticks/nanoseconds are:¶
TrackEntry\DefaultDuration; defined inSection 5.1.4.1.13¶TrackEntry\DefaultDecodedFieldDuration; defined inSection 5.1.4.1.14¶TrackEntry\SeekPreRoll; defined inSection 5.1.4.1.26¶TrackEntry\CodecDelay; defined inSection 5.1.4.1.25¶BlockGroup\DiscardPadding; defined inSection 5.1.3.5.7¶ChapterAtom\ChapterTimeStart; defined inSection 5.1.7.1.4.3¶ChapterAtom\ChapterTimeEnd; defined inSection 5.1.7.1.4.4¶CuePoint\CueTime; defined inSection 5.1.5.1.1¶CueReference\CueRefTime; defined inSection 5.1.5.1.1¶Elements in Segment Ticks involve the use of theTimestampScale Element of the Segment to get the timestampin nanoseconds of the element with the following formula:¶
timestamp in nanosecond = element value * TimestampScale¶
This allows for storage of smaller integer values in the elements.¶
When using the default value of "1,000,000" forTimestampScale, one Segment Tick represents one millisecond.¶
The elements storing values in Segment Ticks are:¶
Cluster\Timestamp; defined inSection 5.1.3.1¶Info\Duration is stored as a floating-point, but the same formula applies; defined inSection 5.1.2.10¶CuePoint\CueTrackPositions\CueDuration; defined inSection 5.1.5.1.2.4¶Elements in Track Ticks involve the use of theTimestampScale Element of the Segment and theTrackTimestampScale Element of the Trackto get the timestamp in nanoseconds of the element with the following formula:¶
timestamp in nanoseconds = element value * TrackTimestampScale * TimestampScale¶
This allows for storage of smaller integer values in the elements.The resulting floating-point values of the timestamps are still expressed in nanoseconds.¶
When using the default values of "1,000,000" forTimestampScale and "1.0" forTrackTimestampScale, one Track Tick represents one millisecond.¶
The elements storing values in Track Ticks are:¶
Cluster\BlockGroup\Block andCluster\SimpleBlock timestamps; detailed inSection 11.2¶Cluster\BlockGroup\BlockDuration; defined inSection 5.1.3.5.3¶Cluster\BlockGroup\ReferenceBlock; defined inSection 5.1.3.5.5¶When theTrackTimestampScale is interpreted as "1.0", Track Ticks are equivalent to Segment Ticksand give an integer value in nanoseconds. This is the most common case asTrackTimestampScale is usually omitted.¶
A value ofTrackTimestampScale other than 1.0MAY be usedto scale the timestamps more in tune with each Track sampling frequency.For historical reasons, a lot of Matroska readers don't take theTrackTimestampScale value into account; thus, using a value other than 1.0 might not work in many places.¶
ABlock Element andSimpleBlock Element timestamp is the time when the decoded data of the firstframe in the Block/SimpleBlockMUST be presented if the track of that Block/SimpleBlock is selected for playback.This is also known as the PTS.¶
TheBlock Element andSimpleBlock Element store their timestamps as signed integers, relativeto theCluster\Timestamp value of theCluster they are stored in.To get the timestamp of aBlock orSimpleBlock in nanoseconds, the following formula has to be used:¶
( Cluster\Timestamp + ( block timestamp * TrackTimestampScale ) ) *TimestampScale¶
TheBlock Element andSimpleBlock Element store their timestamps as 16-bit signed integers,allowing a range from "-32768" to "+32767" Track Ticks.Although these values can be negative, when added to theCluster\Timestamp, the resulting frame timestampSHOULD NOT be negative.¶
When aCodecDelay Element is set, its valueMUST be substracted from each Block timestamp of that track.To get the timestamp in nanoseconds of the first frame in aBlock orSimpleBlock, the formula becomes:¶
( ( Cluster\Timestamp + ( block timestamp * TrackTimestampScale ) ) * TimestampScale ) - CodecDelay¶
The resulting frame timestampSHOULD NOT be negative.¶
During playback, when a frame has a negative timestamp, the contentMUST be decoded by the decoder, but not played to the user.¶
The default Track Tick duration is one millisecond.¶
TheTimestampScale is a floating-point value that is usually 1.0. When it's not 1.0, the multipliedBlock Timestamp is a floating-point value in nanoseconds.TheMatroska ReaderSHOULD use the nearest rounding value in nanoseconds to getthe proper nanosecond timestamp of a Block. This allows some cleverTimestampScale valuesto have a more refined timestamp precision per frame.¶
Matroska from version 1 through 3 uses language codes that can be either the 3 lettersbibliographic ISO 639-2 form[ISO639-2] (like "fre" for French),or such a language code followed by a dash and a country code for specialities in languages (like "fre-ca" for Canadian French).TheISO 639-2 Language Elements are "Language Element", "TagLanguage Element", and "ChapLanguage Element".¶
Starting in Matroska version 4, either[ISO639-2] or[BCP47]MAY be used,althoughBCP 47 isRECOMMENDED. TheBCP 47 Language Elements are "LanguageBCP47 Element","TagLanguageBCP47 Element", and "ChapLanguageBCP47 Element". If aBCP 47 Language Element and anISO 639-2 Language Elementare used within the sameParent Element, then theISO 639-2 Language ElementMUST be ignored; precedence is given to theBCP 47 Language Element.¶
Country codes are the[BCP47] two-letter region subtags without the UK exception.¶
This Matroska specification provides no interoperable solution for securing thedata container with any assurances of confidentiality, integrity, authenticity,or to provide authorization. TheContentEncryption Element (Section 5.1.4.1.31.8)and associated sub-fields (Section 5.1.4.1.31.9 toSection 5.1.4.1.31.12) are definedonly for the benefit of implementers to construct their own proprietary solutionor as the basis for further standardization activities. How to use thesefields to secure a Matroska data container is out of scope, as are any relatedissues, such as key management and distribution.¶
AMatroska Reader who encounters containers that use the fields defined in thissectionMUST rely on out-of-scope guidance to decode the associated content.¶
Because encryption occurs within theBlock Element, it is possible to manipulateencrypted streams without decrypting them. The streams could potentially be copied,deleted, cut, appended, or any number of other possible editing techniques withoutdecryption. The data can be used without having to expose it or go through the decrypting process.¶
Encryption can also be layered within Matroska. This means that two completely differenttypes of encryption can be used, requiring two separate keys to be able to decrypt a stream.¶
Encryption information is stored in theContentEncodings Element under theContentEncryption Element.¶
For encryption systems sharing public/private keys, the creation of the keys and the exchange of keysare not covered by this document. They have to be handled by the system using Matroska.¶
The algorithms described inTable 26 supportdifferent modes of operations and key sizes. The specification of theseparameters is required for a complete solution, but is out of scope of thisdocument and left to the proprietary implementations using them or subsequentprofiles of this document.¶
TheContentEncodingScope Element gives an idea of which part of the track is encrypted, but eachContentEncAlgo Element and its sub-elements (such asAESSettingsCipherMode) define exactly how the encrypted track should be interpreted.¶
An example of an extension that builds upon these security-related fields in this specification is[WebM-Enc].It uses AES-CTR,ContentEncAlgo = 5 (Section 5.1.4.1.31.9), andAESSettingsCipherMode = 1 (Section 5.1.4.1.31.12).¶
AMatroska WriterMUST NOT use insecure cryptographic algorithms to create newarchives or streams, but aMatroska ReaderMAY support these algorithms to readpreviously made archives or streams.¶
ThePixelCrop Elements (PixelCropTop,PixelCropBottom,PixelCropRight, andPixelCropLeft)indicate when, and by how much, encoded video framesSHOULD be cropped for display.These Elements allow edges of the frame that are not intended for display to be stored, but hidden. Examples include thesprockets of a full-frame film scan or the VANC area of a digitized analog videotape.PixelCropTop andPixelCropBottom store an integer of how manyrows of pixelsSHOULD be cropped from the top and bottom of the image, respectively.PixelCropLeft andPixelCropRight store an integer of how many columns of pixelsSHOULD be cropped from the left and right of the image, respectively.¶
For example, a pillar-boxed video that stores a 1440x1080 visual image within the center of a padded 1920x1080 encoded image may set bothPixelCropLeft andPixelCropRight to "240" so that aMatroska Player can crop off 240 columns of pixels from the left and right of the encoded image to present the image with the pillar-boxes hidden.¶
Cropping has to be performed before resizing and the display dimensions given byDisplayWidth,DisplayHeight, andDisplayUnit apply to the image that is already cropped.¶
The ProjectionPoseRoll Element (Section 5.1.4.1.28.46) can be used to indicatethat the image from the associated video trackSHOULD be rotated for presentation.For instance, the following example of the Projection Element (Section 5.1.4.1.28.41)and the ProjectionPoseRoll Element represents a video track where the imageSHOULD bepresented with a 90-degree counter-clockwise rotation, with the EBML tree shown as XML:¶
<Projection> <ProjectionPoseRoll>90</ProjectionPoseRoll></Projection>
TheSegment Position of anElement refers to the position of the first octet of theElement ID of thatElement, measured in octets, from the beginning of theElement Datasection of the containingSegment Element. In other words, theSegment Position of anElement is the distance in octets from the beginning of its containingSegment Elementminus the size of theElement ID andElement Data Size of thatSegment Element.TheSegment Position of the firstChild Element of theSegment Element is 0.AnElement that is not stored within aSegment Element, such as theElements oftheEBML Header, do not have aSegment Position.¶
Elements that are defined to store aSegment PositionMAY define reserved values toindicate a special meaning.¶
This table presents an example of aSegment Position by showing a hexadecimal representationof a very small Matroska file with labels to show the offsets in octets. The file containsaSegment Element with anElement ID of "0x18538067" and aMuxingApp Element with anElement ID of "0x4D80".¶
0 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 0 |1A|45|DF|A3|8B|42|82|88|6D|61|74|72|6F|73|6B|61| ^ EBML Header 0 | |18|53|80|67| ^ Segment ID20 |93| ^ Segment Data Size20 | |15|49|A9|66|8E|4D|80|84|69|65|74|66|57|41|84|69|65|74|66| ^ Start of Segment data20 | |4D|80|84|69|65|74|66|57|41|84|69|65|74|66| ^ MuxingApp start¶
In the above example, theElement ID of theSegment Element is stored at offset 16,theElement Data Size of theSegment Element is stored at offset 20, and theElement Data of theSegment Element is stored at offset 21.¶
TheMuxingApp Element is stored at offset 26. Since theSegment Position ofanElement is calculated by subtracting the position of theElement Data ofthe containingSegment Element from the position of thatElement, theSegment Positionof theMuxingApp Element in the above example is "26 - 21" or "5".¶
Matroska provides several methods to link two or moreSegment Elements together to createaLinked Segment. ALinked Segment is a set of multipleSegments linked together intoa single presentation by using Hard Linking or Medium Linking.¶
AllSegments within aLinked SegmentMUST have aSegmentUUID.¶
AllSegments within aLinked SegmentSHOULD be stored within the same directoryor be quickly accessible based on theirSegmentUUIDin order to have a seamless transition between Segments.¶
AllSegments within aLinked SegmentMAY set aSegmentFamily with a common value to makeit easier for aMatroska Player to know whichSegments are meant to be played together.¶
TheSegmentFilename,PrevFilename, andNextFilename elementsMAY also give hints onthe original filenames that were used when the Segment links were created in case someSegmentUUIDs are damaged.¶
Hard Linking, also called splitting, is the process of creating aLinked Segmentby linking multipleSegment Elements using theNextUUID andPrevUUID Elements.¶
AllSegments within aHard-Linked SegmentMUST use the sameTracks list andTimestampScale.¶
Within aLinked Segment, the timestamps ofBlock andSimpleBlockMUST consecutively follow the timestamps ofBlock andSimpleBlock from the previousSegment in linking order.¶
With Hard Linking, the chapters of anySegment within theLinked SegmentMUST only reference the currentSegment.TheNextUUID andPrevUUID reference the respectiveSegmentUUID values of the next and previousSegments.¶
The firstSegment of aLinked SegmentMUST NOT have aPrevUUID Element.The lastSegment of aLinked SegmentMUST NOT have aNextUUID Element.¶
For each node of the chain ofSegments of aLinked Segment, at least oneSegmentMUST reference the otherSegment within the chain.¶
In a chain ofSegments of aLinked Segment, theNextUUID always takes precedence over thePrevUUID.If SegmentA has aNextUUID to SegmentB and SegmentB has aPrevUUID to SegmentC,the link to use isNextUUID between SegmentA and SegmentB; SegmentC is not part of the Linked Segment.¶
If SegmentB has aPrevUUID to SegmentA, but SegmentA has noNextUUID, then the Matroska PlayerMAY consider these two Segments linked as SegmentA followed by SegmentB.¶
As an example, threeSegments can be Hard Linked as aLinked Segment throughcross-referencing each other withSegmentUUID,PrevUUID, andNextUUID as shown inTable 41:¶
| file name | SegmentUUID | PrevUUID | NextUUID |
|---|---|---|---|
start.mkv | 71000c23cd310998 53fbc94dd984a5dd | Invalid | a77b3598941cb803 eac0fcdafe44fac9 |
middle.mkv | a77b3598941cb803 eac0fcdafe44fac9 | 71000c23cd310998 53fbc94dd984a5dd | 6c92285fa6d3e827 b198d120ea3ac674 |
end.mkv | 6c92285fa6d3e827 b198d120ea3ac674 | a77b3598941cb803 eac0fcdafe44fac9 | Invalid |
An example where only theNextUUID Element is used:¶
| file name | SegmentUUID | PrevUUID | NextUUID |
|---|---|---|---|
start.mkv | 71000c23cd310998 53fbc94dd984a5dd | Invalid | a77b3598941cb803 eac0fcdafe44fac9 |
middle.mkv | a77b3598941cb803 eac0fcdafe44fac9 | n/a | 6c92285fa6d3e827 b198d120ea3ac674 |
end.mkv | 6c92285fa6d3e827 b198d120ea3ac674 | n/a | Invalid |
An example where only thePrevUUID Element is used:¶
| file name | SegmentUUID | PrevUUID | NextUUID |
|---|---|---|---|
start.mkv | 71000c23cd310998 53fbc94dd984a5dd | Invalid | n/a |
middle.mkv | a77b3598941cb803 eac0fcdafe44fac9 | 71000c23cd310998 53fbc94dd984a5dd | n/a |
end.mkv | 6c92285fa6d3e827 b198d120ea3ac674 | a77b3598941cb803 eac0fcdafe44fac9 | Invalid |
An example where only themiddle.mkv is using thePrevUUID andNextUUID Elements:¶
| file name | SegmentUUID | PrevUUID | NextUUID |
|---|---|---|---|
start.mkv | 71000c23cd310998 53fbc94dd984a5dd | Invalid | n/a |
middle.mkv | a77b3598941cb803 eac0fcdafe44fac9 | 71000c23cd310998 53fbc94dd984a5dd | 6c92285fa6d3e827 b198d120ea3ac674 |
end.mkv | 6c92285fa6d3e827 b198d120ea3ac674 | n/a | Invalid |
Medium Linking creates relationships betweenSegments using Ordered Chapters (Section 20.1.3) and theChapterSegmentUUID Element. AChapter Edition with Ordered ChaptersMAY containChapter elements that reference timestamp ranges from otherSegments. TheSegmentreferenced by the Ordered Chapter via theChapterSegmentUUID ElementSHOULD be played aspart of a Linked Segment.¶
The timestamps of Segment content referenced by Ordered ChaptersMUST be adjusted according to the cumulative duration of the previous Ordered Chapters.¶
As an example, a file namedintro.mkv could have aSegmentUUID of "0xb16a58609fc7e60653a60c984fc11ead".Another file calledprogram.mkv could use a Chapter Edition that contains two Ordered Chapters.The first chapter references theSegment ofintro.mkv with the use of aChapterSegmentUUID,ChapterSegmentEditionUID,ChapterTimeStart, and an optionalChapterTimeEnd element.The second chapter references content within theSegment ofprogram.mkv. AMatroska PlayerSHOULD recognize theLinked Segment created by the use ofChapterSegmentUUID in an enabledEdition and present the reference content of the twoSegments as a single presentation.¶
TheChapterSegmentUUID represents the Segment that holds the content to play in place of theLinked Chapter.TheChapterSegmentUUIDMUST NOT be theSegmentUUID of its ownSegment.¶
There are two ways to use a chapter link:¶
AMatroska PlayerMUST play the content of the linked Segmentfrom theChapterTimeStart until theChapterTimeEnd timestamp in place of theLinked Chapter.¶
ChapterTimeStart andChapterTimeEnd represent timestamps in the Linked Segment matching the value ofChapterSegmentUUID.Their valuesMUST be in the range of the linked Segment duration.¶
TheChapterTimeEnd valueMUST be set when using Linked-Duration chapter linking.ChapterSegmentEditionUIDMUST NOT be set.¶
AMatroska PlayerMUST play the whole LinkedEdition of the linked Segment in place of theLinked Chapter.¶
ChapterSegmentEditionUID represents a valid Edition from the Linked Segment matching the value ofChapterSegmentUUID.¶
When using Linked-Edition chapter linking,ChapterTimeEnd isOPTIONAL.¶
The "Default Track flag" is a hint for aMatroska Player indicating that a given trackSHOULD be eligible to be automatically selected as the default track for a givenlanguage. If no tracks in a given language have the Default Track flag set, then all tracksin that language are eligible for automatic selection. This can be used to indicate thata track provides "regular service" that is suitable for users with default settings as opposed tospecialized services, such as commentary, hearing-impaired captions, or descriptive audio.¶
TheMatroska PlayerMAY override the Default Track flag for any reason, includinguser preferences to prefer tracks providing accessibility services.¶
The "Forced flag" tells theMatroska Player that itSHOULD display this subtitle track,even if user preferences usually would not call for any subtitles to be displayed alongsidethe audio track that is currently selected. This can be used to indicate that a track contains translationsof onscreen text or dialogue spoken in a different language than the track's primary language.¶
The "Hearing-impaired flag" tells theMatroska Player that itSHOULD prefer this trackwhen selecting a default track for a hearing-impaired user and that itMAY prefer to selecta different track when selecting a default track for a user that is not hearing-impaired.¶
The "Visually Impaired flag" tells theMatroska Player that itSHOULD prefer this trackwhen selecting a default track for a visually impaired user and that itMAY prefer to selecta different track when selecting a default track for a user that is not visually impaired.¶
The "Descriptions flag" tells theMatroska Player that this trackis suitable to play via a text-to-speech system for a visually impaired userand that itSHOULD NOT automatically select this track whenselecting a default track for a user that is not visually impaired.¶
The "Original flag" tells theMatroska Player that this track is in the original languageand that itSHOULD prefer the original language if it's configured to prefer original-language tracks of thistrack's type.¶
The "Commentary flag" tells theMatroska Player that this track contains commentary onthe content.¶
TrackOperation allows for the combination of multiple tracks to make a virtual one. It usestwo separate system to combine tracks. One to create a 3D "composition" (left / right / background planes)and one to simplify join two tracks together to make a single track.¶
A track created withTrackOperation is a proper track with a UID and all its flags.However, the codec ID is meaningless because each "sub" track needs to be decoded by itsown decoder before the "operation" is applied. TheCues Elements corresponding to sucha virtual trackSHOULD be the union of theCues Elements for each of the tracks it's composed of (when theCues are defined per track).¶
In the case ofTrackJoinBlocks, theBlock Elements (fromBlockGroup andSimpleBlock)of all the tracksSHOULD be used as if they were defined for this new virtualTrack.When twoBlock Elements have overlapping start or end timestamps, it's up to the underlyingsystem to either drop some of these frames or render them the way they overlap.This situationSHOULD be avoided when creating such tracks, as you can never be sureof the end result on different platforms.¶
Overlay tracksSHOULD be rendered in the same channel as the track it's linked to.When content is found in such a track, itSHOULD be played on the rendering channelinstead of the original track.¶
There are two different ways to compress 3D videos: have each eye track in a separate trackand have one track have both eyes combined inside (which is more efficient compression-wise).Matroska supports both ways.¶
For the single track variant, there is theStereoMode Element, which defines how planes areassembled in the track (mono or left-right combined). Odd values of StereoMode means the leftplane comes first for more convenient reading. The pixel count of the track (PixelWidth/PixelHeight)is the raw amount of pixels, e.g., 3840x1080 for full HD side by side and theDisplayWidth/DisplayHeightin pixels is the amount of pixels for one plane (1920x1080 for that full HD stream).Old stereo 3D were displayed using anaglyph (cyan and red colors separated).For compatibility with such movies, there is a value of the StereoMode that corresponds to AnaGlyph.¶
There is also a "packed" mode (values 13 and 14) that consists of packing two frames togetherin aBlock that uses lacing. The first frame is the left eye and the other frame is the right eye(or vice versa). The framesSHOULD be decoded in that order and are possibly dependenton each other (P and B frames).¶
For separate tracks, Matroska needs to define exactly which track does what.TrackOperation withTrackCombinePlanes does that. For more details, seeSection 18.8 to view how TrackOperation works.¶
The 3D support is still in infancy and may evolve to support more features.¶
The StereoMode used to be part of Matroska v2, but it didn't meet the requirementfor multiple tracks. There was also a bug in libmatroska prior to 0.9.0 that would save/readit as0x53B9 instead of0x53B8; see OldStereoMode (Section 5.1.4.1.28.5).Matroska ReadersMAY support these legacy files by checkingMatroska v2 or0x53B9.The older values of StereoMode were 0: mono, 1: right eye, 2: left eye, and 3: both eyes; these are the only values that can be found in OldStereoMode.They are not compatible with the StereoMode values found in Matroska v3 and above.¶
This section provides some example sets of Tracks and hypothetical user settings, along withindications of which Tracks that a similarly-configuredMatroska PlayerSHOULD automaticallyselect for playback by default in such a situation. A playerMAY provide additional settingswith more detailed controls for more nuanced scenarios. These examples are provided as guidelinesto illustrate the intended usages of the various supported Track flags and their expected behaviors.¶
Track names are shown in English for illustrative purposes; actual files may have titlesin the language of each track or provide titles in multiple languages.¶
Example track set:¶
| No. | Type | Lang | Layout | Original | Default | Other Flags | Name |
|---|---|---|---|---|---|---|---|
| 1 | Video | und | N/A | N/A | N/A | None | |
| 2 | Audio | eng | 5.1 | 1 | 1 | None | |
| 3 | Audio | eng | 2.0 | 1 | 1 | None | |
| 4 | Audio | eng | 2.0 | 1 | 0 | Visually Impaired | Descriptive audio |
| 5 | Audio | esp | 5.1 | 0 | 1 | None | |
| 6 | Audio | esp | 2.0 | 0 | 0 | Visually Impaired | Descriptive audio |
| 7 | Audio | eng | 2.0 | 1 | 0 | Commentary | Director's Commentary |
| 8 | Audio | eng | 2.0 | 1 | 0 | None | Karaoke |
The table above shows a file with 7 audio tracks, 5 of which are in English and 2 are in Spanish.¶
The English tracks all have the Original flag indicating that English is the original content language.¶
Generally, the player will first consider the track languages. If the player has an option to preferoriginal-language audio and the user has enabled it, then it should prefer one of the tracks that have the Original flag.If configured to specifically prefer audio tracks in English or Spanish, the player should select one ofthe tracks in the corresponding language. The player may also wish to prefer a track with the Original flagif no tracks matching any of the user's explicitly-preferred languages are available.¶
Two of the tracks have the Visually Impaired flag. If the player has been configured to prefer such tracks,it should select one; otherwise, it should avoid them if possible.¶
If selecting an English track, when other settings have left multiple possible options,it may be useful to exclude the tracks that lack the Default flag. Here, one provides descriptive service forthe visually impaired (which has its own flag and may be automatically selected by user configuration,but is unsuitable for users with default-configured players), one is a commentary track(which has its own flag and the player may or may not have specialized handling for),and the last option contains karaoke versions of the music that plays during the film (which is an unusualspecialized audio service that Matroska has no built-in support for indicating, so it's indicatedin the track name instead). By not setting the Default flag on these specialized tracks, the file's authorhints that they should not be automatically selected by a default-configured player.¶
Having narrowed its choices down, the example player now may have to select between tracks 2 and 3.The only difference between these tracks is their channel layouts. 2 is 5.1 surround while 3 is stereo.If the player is aware that the output device is a pair of headphones or stereo speakers, it may wishto prefer the stereo mix automatically. On the other hand, if it knows that the device is a surround system,it may wish to prefer the surround mix.¶
If the player finishes analyzing all of the available audio tracks and finds that multiple seem equallyand maximally preferable, itSHOULD default to the first of the group.¶
Example track set:¶
| No. | Type | Lang | Original | Default | Forced | Other flags | Name |
|---|---|---|---|---|---|---|---|
| 1 | Video | und | N/A | N/A | N/A | None | |
| 2 | Audio | fra | 1 | 1 | N/A | None | |
| 3 | Audio | por | 0 | 1 | N/A | None | |
| 4 | Subtitles | fra | 1 | 1 | 0 | None | |
| 5 | Subtitles | fra | 1 | 0 | 0 | Hearing-impaired | Captions for the hearing-impaired |
| 6 | Subtitles | por | 0 | 1 | 0 | None | |
| 7 | Subtitles | por | 0 | 0 | 1 | None | Signs |
| 8 | Subtitles | por | 0 | 0 | 0 | Hearing-impaired | SDH |
The table above shows 2 audio tracks and 5 subtitle tracks. As we can see, French is the original language.¶
We'll start by discussing the case where the user prefers French (or original-language)audio (or has explicitly selected the French audio track), and also prefers French subtitles.¶
In this case, if the player isn't configured to display captions when the audio matches theirpreferred subtitle languages, the player doesn't need to select a subtitle track at all.¶
If the userhas indicated that they want captions to be displayed, the selection simplycomes down to whether hearing-impaired subtitles are preferred.¶
The situation for a user who prefers Portuguese subtitles starts out somewhat analogous.If they select the original French audio (either by explicit audio language preference,preference for original-language tracks, or by explicitly selecting that track), then theselection once again comes down to the hearing-impaired preference.¶
However, the case where the Portuguese audio track is selected has an important catch:a Forced track in Portuguese is present. This may contain translations of onscreen textfrom the video track or of portions of the audio that are not translated (music, for instance).This means that even if the user's preferences wouldn't normally call for captions here,the Forced track should be selected nonetheless rather than selecting no track at all.On the other hand, if the user's preferencesdo call for captions, the non-Forced tracksshould be preferred, as the Forced track will not contain captioning for the dialogue.¶
The Matroska Chapters system can have multipleEditions and eachEdition can consist ofSimple Chapters where a chapter start time is used as a marker in the timeline only. AnEdition can be more complex withOrdered Chapters where a chapter end time stamp is additionallyused or much more complex withLinked Chapters. The Matroska Chapters system can also have a menustructure borrowed from the DVD-menu system[DVD-Video] or have its own built-in Matroska menu structure.¶
TheEditionEntry is also called anEdition.AnEdition contains a set ofEdition flags andMUST contain at least oneChapterAtom Element.Chapters are always inside anEdition (or a Chapter itself is part of anEdition).Multiple Editions are allowed. Some of these EditionsMAY be ordered and others are not.¶
Only oneEditionSHOULD have anEditionFlagDefault flag set totrue.¶
TheDefault Edition is theEdition that aMatroska PlayerSHOULD use for playback by default.¶
The firstEdition with theEditionFlagDefault flag set totrue is theDefault Edition.¶
When allEditionFlagDefault flags are set tofalse, then the firstEditionis theDefault Edition.¶
| Edition | FlagDefault | Default Edition |
|---|---|---|
| Edition 1 | true | X |
| Edition 2 | true | |
| Edition 3 | true |
| Edition | FlagDefault | Default Edition |
|---|---|---|
| Edition 1 | false | X |
| Edition 2 | false | |
| Edition 3 | false |
| Edition | FlagDefault | Default Edition |
|---|---|---|
| Edition 1 | false | |
| Edition 2 | true | X |
| Edition 3 | false |
TheEditionFlagOrdered Flag is a significant feature, as it enables anEditionofOrdered Chapters that define and arrange a virtual timeline rather than simplylabeling points within the timeline. For example, withEditions ofOrdered Chapters,a singleMatroska file can present multiple edits of a film without duplicating content.Alternatively, if a videotape is digitized in full, oneOrdered Edition could presentthe full content (including colorbars, countdown, slate, a feature presentation, andblack frames) while anotherEdition ofOrdered Chapters can useChapters that onlymark the intended presentation with the colorbars and other ancillary visual informationexcluded. If anEdition ofOrdered Chapters is enabled, then theMatroska PlayerMUSTplay those Chapters in their stored order from the timestamp marked in theChapterTimeStart Element to the timestamp marked in toChapterTimeEnd Element.¶
If theEditionFlagOrdered Flag evaluates to "0",Simple Chapters are used andonly theChapterTimeStart of aChapter is used as a chapter mark to jump to thepredefined point in the timeline. WithSimple Chapters, aMatroska PlayerMUSTignore certainChapter Elements. In that case, these elements are informational only.¶
The following list shows the different Chapter elements only found inOrdered Chapters.¶
Furthermore, there are other EBMLElements that could be used if theEditionFlagOrderedevaluates to "1".¶
Ordered Chapters supersede theHard Linking.¶Ordered Chapters are used in a normal way and can be combinedwith theChapterSegmentUUID element, which establishes a link to another Segment.¶SeeSection 17 on the Linked Segments for more informationaboutHard Linking andMedium Linking.¶
TheChapterAtom is also called aChapter.¶
ChapterTimeStart is the timestamp of the start ofChapter with nanosecond accuracy and is not scaled by TimestampScale.ForSimple Chapters, this is the position of the chapter markers in the timeline.¶
ChapterTimeEnd is the timestamp of the end ofChapter with nanosecond accuracy and is not scaled by TimestampScale.The timestamp defined by theChapterTimeEnd is not part of theChapter.AMatroska Player calculates the duration of thisChapter by using the difference between theChapterTimeEnd andChapterTimeStart.The end timestampMUST be greater than or equal to the start timestamp.¶
When theChapterTimeEnd timestamp is equal to theChapterTimeStart timestamp,the timestamps is included in theChapter. It can be useful to put markers ina file or add chapter commands with ordered chapter commands without having to play anything;seeSection 5.1.7.1.4.14.¶
| Chapter | Start timestamp | End timestamp | Duration |
|---|---|---|---|
| Chapter 1 | 0 | 1000000000 | 1000000000 |
| Chapter 2 | 1000000000 | 5000000000 | 4000000000 |
| Chapter 3 | 6000000000 | 6000000000 | 0 |
| Chapter 4 | 9000000000 | 8000000000 | Invalid (-1000000000) |
AChapterAtom element can contain otherChapterAtom elements.That element is aParent Chapter and theChapterAtom elements it contains areNested Chapters.¶
Nested Chapters can be useful to tag small parts of a Segment that already has tags oradd Chapter Codec commands on smaller parts of a Segment that already has Chapter Codec commands.¶
TheChapterTimeStart of aNested ChapterMUST be greater than or equal to theChapterTimeStart of itsParent Chapter.¶
If theParent Chapter of aNested Chapter has aChapterTimeEnd, theChapterTimeStart of thatNested ChapterMUST be smaller than or equal to theChapterTimeEnd of theParent Chapter.¶
TheChapterTimeEnd of the lowest level ofNested ChaptersMUST be set for Ordered Chapters.¶
When used with Ordered Chapters, theChapterTimeEnd value of aParent Chapter is useless for playback,as the proper playback sections are described in itsNested Chapters.TheChapterTimeEndSHOULD NOT be set inParent Chapters andMUST be ignored for playback.¶
Each Chapterwithin aChapterFlagHidden flag works independently of Parent Chapters.ANested Chapter with aChapterFlagHidden flag that evaluates to "0" remains visible in the user interface even if theParent ChapterChapterFlagHidden flag is set to "1".¶
| Chapter + Nested Chapter | ChapterFlagHidden | visible |
|---|---|---|
| Chapter 1 | 0 | yes |
| Nested Chapter 1.1 | 0 | yes |
| Nested Chapter 1.2 | 1 | no |
| Chapter 2 | 1 | no |
| Nested Chapter 2.1 | 0 | yes |
| Nested Chapter 2.2 | 1 | no |
The menu features are handled like achapter codec. That means each codec has a type,some private data, and some data in the chapters.¶
The type of the menu system is defined by theChapProcessCodecID parameter. For now,only two values are supported: 0 Matroska Script, 1 menu borrowed from the DVD[DVD-Video].The private data depends on the type of menu system (stored inChapProcessPrivate), which is the same for the data in the chapters (stored inChapProcessData).¶
The menu system, as well as Chapter Codecs in general, can perform actions on theMatroska Player, such as jumping to another Chapter or Edition, selecting different tracks, and possibly more.The scope of all the possibilities of Chapter Codecs is not covered in this document, as itdepends on the Chapter Codec features and its integration in aMatroska Player.¶
Each level can have different meanings for audio and video. TheORIGINAL_MEDIA_TYPE tag[MatroskaTags] can be used tospecify a string for ChapterPhysicalEquiv = 60. Here is the list of possible levels for both audio and video:¶
| Value | Audio | Video | Comment |
|---|---|---|---|
| 70 | SET / PACKAGE | SET / PACKAGE | The collection of different media. |
| 60 | CD / 12" / 10" / 7" / TAPE / MINIDISC / DAT | DVD / VHS / LASERDISC | The physical medium, such as a CD or a DVD. |
| 50 | SIDE | SIDE | When the original medium (LP/DVD) has different sides. |
| 40 | - | LAYER | Another physical level on DVDs. |
| 30 | SESSION | SESSION | As found on CDs and DVDs. |
| 20 | TRACK | - | As found on CDs. |
| 10 | INDEX | - | The first logical level of the side/medium. |
In this example, a movie is split in different chapters. It could also just be anaudio file (album) in which each track corresponds to a chapter.¶
This would translate in the following Matroska form, with the EBML tree shown as XML:¶
<Chapters> <EditionEntry> <EditionUID>16603393396715046047</EditionUID> <ChapterAtom> <ChapterUID>1193046</ChapterUID> <ChapterTimeStart>0</ChapterTimeStart> <ChapterTimeEnd>5000000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Intro</ChapString> </ChapterDisplay> </ChapterAtom> <ChapterAtom> <ChapterUID>2311527</ChapterUID> <ChapterTimeStart>5000000000</ChapterTimeStart> <ChapterTimeEnd>25000000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Before the crime</ChapString> </ChapterDisplay> <ChapterDisplay> <ChapString>Avant le crime</ChapString> <ChapLanguage>fra</ChapLanguage> </ChapterDisplay> </ChapterAtom> <ChapterAtom> <ChapterUID>3430008</ChapterUID> <ChapterTimeStart>25000000000</ChapterTimeStart> <ChapterTimeEnd>27500000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>The crime</ChapString> </ChapterDisplay> <ChapterDisplay> <ChapString>Le crime</ChapString> <ChapLanguage>fra</ChapLanguage> </ChapterDisplay> </ChapterAtom> <ChapterAtom> <ChapterUID>4548489</ChapterUID> <ChapterTimeStart>27500000000</ChapterTimeStart> <ChapterTimeEnd>38000000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>After the crime</ChapString> </ChapterDisplay> <ChapterDisplay> <ChapString>Apres le crime</ChapString> <ChapLanguage>fra</ChapLanguage> </ChapterDisplay> </ChapterAtom> <ChapterAtom> <ChapterUID>5666960</ChapterUID> <ChapterTimeStart>38000000000</ChapterTimeStart> <ChapterTimeEnd>43000000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Credits</ChapString> </ChapterDisplay> <ChapterDisplay> <ChapString>Generique</ChapString> <ChapLanguage>fra</ChapLanguage> </ChapterDisplay> </ChapterAtom> </EditionEntry></Chapters>
In this example, an (existing) album is split into different chapters and oneof them contains another splitting.¶
00:00 - 12:28: Baby wants to Bleep/Rock¶
This would translate in the following Matroska form, with the EBML tree shown as XML:¶
<Chapters> <EditionEntry> <EditionUID>1281690858003401414</EditionUID> <ChapterAtom> <ChapterUID>1</ChapterUID> <ChapterTimeStart>0</ChapterTimeStart> <ChapterTimeEnd>748000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to Bleep/Rock</ChapString> </ChapterDisplay> <ChapterAtom> <ChapterUID>2</ChapterUID> <ChapterTimeStart>0</ChapterTimeStart> <ChapterTimeEnd>278000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to bleep (pt.1)</ChapString> </ChapterDisplay> </ChapterAtom> <ChapterAtom> <ChapterUID>3</ChapterUID> <ChapterTimeStart>278000000</ChapterTimeStart> <ChapterTimeEnd>432000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to rock</ChapString> </ChapterDisplay> </ChapterAtom> <ChapterAtom> <ChapterUID>4</ChapterUID> <ChapterTimeStart>432000000</ChapterTimeStart> <ChapterTimeEnd>633000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to bleep (pt.2)</ChapString> </ChapterDisplay> </ChapterAtom> <ChapterAtom> <ChapterUID>5</ChapterUID> <ChapterTimeStart>633000000</ChapterTimeStart> <ChapterTimeEnd>748000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to bleep (pt.3)</ChapString> </ChapterDisplay> </ChapterAtom> </ChapterAtom> <ChapterAtom> <ChapterUID>6</ChapterUID> <ChapterTimeStart>750000000</ChapterTimeStart> <ChapterTimeEnd>1178500000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Bleeper_O+2</ChapString> </ChapterDisplay> </ChapterAtom> <ChapterAtom> <ChapterUID>7</ChapterUID> <ChapterTimeStart>1180500000</ChapterTimeStart> <ChapterTimeEnd>1340000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to bleep (pt.4)</ChapString> </ChapterDisplay> </ChapterAtom> <ChapterAtom> <ChapterUID>8</ChapterUID> <ChapterTimeStart>1342000000</ChapterTimeStart> <ChapterTimeEnd>1518000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Bleep to bleep</ChapString> </ChapterDisplay> </ChapterAtom> <ChapterAtom> <ChapterUID>9</ChapterUID> <ChapterTimeStart>1520000000</ChapterTimeStart> <ChapterTimeEnd>2015000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to bleep (k)</ChapString> </ChapterDisplay> </ChapterAtom> <ChapterAtom> <ChapterUID>10</ChapterUID> <ChapterTimeStart>2017000000</ChapterTimeStart> <ChapterTimeEnd>2668000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Bleeper</ChapString> </ChapterDisplay> </ChapterAtom> </EditionEntry></Chapters>
Matroska supports storage of related files and data in theAttachments Element(aTop-Level Element).Attachment Elements can be used to store related cover art,font files, transcripts, reports, error recovery files, picture or text-based annotations,copies of specifications, or other ancillary files related to theSegment.¶
Matroska ReadersMUST NOT execute files stored asAttachment Elements.¶
This section defines a set of guidelines for the storage of cover art in Matroska files.AMatroska ReaderMAY use embedded cover art to display a representationalstill-image depiction of the multimedia contents of the Matroska file.¶
Only[JPEG] and PNG[RFC2083] image formatsSHOULD be used for cover art pictures.¶
There can be two different covers for a movie/album: a portrait style (e.g., a DVD case)and a landscape style (e.g., a wide banner ad).¶
There can be two versions of the same cover: thenormal cover andthesmall cover. The dimension of thenormal coverSHOULD be 600 pixels on the smallest side (e.g., 960x600 forlandscape, 600x800 for portrait, or 600x600 for square). The dimension of thesmall coverSHOULD be 120 pixels on the smallest side(e.g., 192x120 or 120x160).¶
Versions of cover art can be differentiated by the filename that is stored in theFileName Element. The default filename of thenormal cover in square or portrait modeiscover.(jpg|png). When stored, thenormal coverSHOULD be the first Attachment instorage order. Thesmall coverSHOULD be prefixed with "small_", such assmall_cover.(jpg|png). The landscape variantSHOULD be suffixed with "_land",such ascover_land.(jpg|png). The filenames are case-sensitive.¶
The following table provides examples of file names for cover art in Attachments.¶
| FileName | Image Orientation | Pixel Length of Smallest Side |
|---|---|---|
| cover.jpg | Portrait or square | 600 |
| small_cover.png | Portrait or square | 120 |
| cover_land.png | Landscape | 600 |
| small_cover_land.jpg | Landscape | 120 |
Font filesMAY be added to a Matroska file as Attachments so that the font file may be usedto display an associated subtitle track. This allows the presentation of a Matroska file to beconsistent in various environments where the needed fonts might not be available on the local system.¶
Depending on the font format in question, each font file can contain multiple font variants.Each font variant has a name that will be referred to as Font Name from now on.This Font Name can be different from the Attachment'sFileName, even when disregarding the extension.In order to select a font for display, a Matroska playerSHOULD consider both the Font Nameand the base name of the Attachment's FileName, preferring the former when there are multiple matches.¶
Subtitle codecs, such as SubStation Alpha (SSA/ASS), usually refer to a font by its Font Name and instead of its filename.If none of the Attachments are a match for the Font Name, the Matroska playerSHOULDattempt to find a system font whose Font Name matches the one used in the subtitle track.¶
Since loading fonts temporarily can take a while, a Matroska player usuallyloads or installs all the fonts found in attachments so they are ready to be used during playback.Failure to use the font attachment might result in incorrect rendering of the subtitles.¶
If a selected subtitle track has someAttachmentLink elements, the playerMAY restrict its font rendering to use only these fonts.¶
A Matroska playerSHOULD handle the official font media types from[RFC8081] when the system can handle the type:¶
font/sfnt:font/ttf:font/otf:font/collection:font/woff:font/woff2:Fonts in Matroska existed long before[RFC8081]. A few unofficial media types for fonts were used in existing files.Therefore, it isRECOMMENDED for a Matroska player to support the following legacy media types for font attachments:¶
application/x-truetype-font:font/ttf and sometimesfont/otf.¶application/x-font-ttf:font/ttf.¶application/vnd.ms-opentype:font/otf¶application/font-sfnt:font/sfnt¶application/font-woff:font/woff¶There may also be some font attachments with theapplication/octet-stream media type.In that case, the Matroska playerMAY try to guess the font type by checking the file extension of theAttachedFile\FileName string.Common file extensions for fonts are:¶
.ttf for TTFs, equivalent tofont/ttf;¶
.otf for OTF fonts, equivalent tofont/otf; and¶
.ttc for Collection fonts, equivalent tofont/collection.¶
The file extension checkMUST be case-insensitive.¶
Matroska WritersSHOULD use a valid font media type from[RFC8081] in theAttachedFile\FileMediaType of the font attachment.TheyMAY use the media types found in older files when compatibility with older players is necessary.¶
TheCues Element provides an index of certainCluster Elements to allow for optimizedseeking to absolute timestamps within theSegment. TheCues Element contains one ormanyCuePoint Elements, and eachMUST reference an absolute timestamp (via theCueTime Element), aTrack (via theCueTrack Element), and aSegment Position(via theCueClusterPosition Element). Additional non-mandated Elements are part oftheCuePoint Element, such asCueDuration,CueRelativePosition,CueCodecState,and others that provide anyMatroska Reader with additional information to use inthe optimization of seeking performance.¶
The following recommendations are provided to optimize Matroska performance.¶
Unless Matroska is used as a live stream, itSHOULD contain aCues Element.¶
For each video track, each keyframeSHOULD be referenced by aCuePoint Element.¶
It isRECOMMENDED to not reference non-keyframes of video tracks inCues unlessit references aCluster Element that contains aCodecState Element, but no keyframes.¶
For each subtitle track present, each subtitle frameSHOULD be referenced by aCuePoint Element with aCueDuration Element.¶
References to audio tracksMAY be skipped inCuePoint Elements if a video trackis present. When included, theCuePoint ElementsSHOULD reference audio keyframesonce every 500 milliseconds at most.¶
If the referenced frame is not stored within the firstSimpleBlock or firstBlockGroup within itsCluster Element, then theCueRelativePosition ElementSHOULD be written to reference where in theCluster the reference frame is stored.¶
If aCuePoint Element references aCluster Element that includes aCodecState Element,then thatCuePoint ElementMUST use aCueCodecState Element.¶
CuePoint ElementsSHOULD be numerically sorted in storage order by the value of theCueTime Element.¶
In Matroska, there are two kinds of streaming: file access and livestreaming.¶
File access can simply be reading a file located on your computer, but it also includesaccessing a file from an HTTP (web) server or Common Internet File System (CIFS) (Windows share) server. These protocolsare usually safe from reading errors and seeking in the stream is possible. However,when a file is stored far away or on a slow server, seeking can be an expensive operationand should be avoided. The guidelines inSection 25, when followed, help reduce the numberof seeking operations for regular playback and also have the playback start quickly withouta lot of data needed to read first (such as aCues Element,Attachment Element, orSeekHead Element).¶
Matroska, having a small overhead, is well suited for storing music/videos on fileservers without a big impact on the bandwidth used. Matroska does not require the indexto be loaded before playing, which allows playback to start very quickly. The index canbe loaded only when seeking is requested the first time.¶
Livestreaming is the equivalent of television broadcasting on the Internet. There are twofamilies of servers for livestreaming: RTP / Real-Time Streaming Protocol (RTSP) and HTTP. Matroska is not meant to beused over RTP. RTP already has timing and channel mechanisms that would be wasted if doubledin Matroska. Additionally, having the same information at the RTP and Matroska level wouldbe a source of confusion if they do not match.Livestreaming of Matroska over file-like protocols like HTTP, QUIC, etc., is possible.¶
A live Matroska stream is different from a file because it usually has no known end(only ending when the client disconnects). For this, all bits of the "size" portionof theSegment ElementMUST be set to 1. Another option is to concatenateSegment Elementswith known sizes one after the other. This solution allows a change of codec/resolutionbetween each Segment. For example, this allows for a switch between 4:3 and 16:9 in a television program.¶
WhenSegment Elements are continuous, certainElements likeSeekHead,Cues,Chapters, andAttachmentsMUST NOT be used.¶
It is possible for aMatroska Player to detect that a stream is not seekable.If the stream has neither aSeekHead list nor aCues list at the beginning of the stream,itSHOULD be considered non-seekable. Even though it is possible to seek forwardin the stream, it isNOT RECOMMENDED.¶
In the context of live radio or web TV, it is possible to "tag" the content while it isplaying. TheTags Element can be placed betweenClusters each time it is necessary.In that case, the newTags ElementMUST reset the previously encounteredTags Elementsand use the new values instead.¶
Tags allow tagging all kinds of Matroska parts with very detailed metadata in multiple languages.¶
Some Matroska elements also contain their own string value, such as the Track Name (Section 5.1.4.1.18) or the Chapter String (Section 5.1.7.1.4.10).¶
The following Matroska elements can also be defined with tags:¶
The Track Name Element (Section 5.1.4.1.18) corresponds to a tag with the TagTrackUID (Section 5.1.8.1.1.3) set to the given track, a TagName ofTITLE (Section 5.1.8.1.2.1), and a TagLanguage (Section 5.1.8.1.2.2) or TagLanguageBCP47 (Section 5.1.8.1.2.3) of "und".¶
The Chapter String Element (Section 5.1.7.1.4.10) corresponds to a tag with the TagChapterUID (Section 5.1.8.1.1.5) set to the same chapter UID, a TagName ofTITLE (Section 5.1.8.1.2.1), and a TagLanguage (Section 5.1.8.1.2.2) or TagLanguageBCP47 (Section 5.1.8.1.2.3) matching the ChapLanguage (Section 5.1.7.1.4.11) or ChapLanguageBCP47 (Section 5.1.7.1.4.12), respectively.¶
The FileDescription Element (Section 5.1.6.1.1) of an attachment corresponds to a tag with the TagAttachmentUID (Section 5.1.8.1.1.6) set to the given attachment, a TagName ofTITLE (Section 5.1.8.1.2.1), and a TagLanguage (Section 5.1.8.1.2.2) or TagLanguageBCP47 (Section 5.1.8.1.2.3) of "und".¶
When both values exist in the file, the value found in Tags takes precedence over the value found in original location of the element.For example, if you have aTrackEntry\Name element and TagTITLE for that track in a Matroska Segment, the Tag stringSHOULD be used instead of theTrackEntry\Name string to identify the track.¶
As the Tag element is optional, a lot ofMatroska Readers do not handle it and will not use the tags value when it's found.For maximum compatibility, it's usually better to put the strings in theTrackEntry,ChapterAtom, andAttachmentand keep the tags matching these values if tags are also used.¶
Tag elements allow tagging information on multiple levels; each level has aTargetTypeValueSection 5.1.8.1.1.1.An element for a givenTargetTypeValue also applies to the lower levels denoted by smallerTargetTypeValue values. If an upper valuedoesn't apply to a level, but the actual value to use is not known,an emptyTagString element(Section 5.1.8.1.2.5) or an emptyTagBinary element (Section 5.1.8.1.2.6)MUST be used as the tag value for this level.¶
See[MatroskaTags] for more details on common tag names, types, and descriptions.¶
It isRECOMMENDED that each individualCluster Element contains no more thanfive seconds or five megabytes of content.¶
It isRECOMMENDED that the firstSeekHead Element be followed by aVoid Element toallow for theSeekHead Element to be expanded to cover newTop-Level Elementsthat could be added to the Matroska file, such asTags,Chapters, andAttachments Elements.¶
The size of thisVoid Element should be adjusted depending on the Matroska file that already hasTags,Chapters, andAttachments Elements.¶
While there can beTop-Level Elements in any order, some ordering of Elements are better than others.The following sections detail a few optimum layouts for different use cases.¶
This is the basic layout muxers should be using for an efficient playback experience:¶
When tags from the previous layout need to be extended, they are moved to the end with the extra information.The location where the old tags were located is voided.¶
Cues are usually a big chunk of data referencing a lot of locations in the file.Players that want to seek in the file need to seek to the end of the fileto access these locations. It is often better if they are placed early in the file.On the other hand, that means players that don't intend to seek will have to read/skipthis data no matter what.¶
Because the Cues reference locations further in the file, it's often complicated toallocate the proper space for that element before all the locations are known.Therefore, this layout is rarely used:¶
In Livestreaming (Section 23.2), only a few elements make sense. For example, SeekHead and Cues are useless.All elements other than the ClustersMUST be placed before the Clusters.¶
Matroska inherits security considerations from EBML.¶
Attacks on aMatroska Reader could include:¶
Storage of an arbitrary and potentially executable data within anAttachment Element.Matroska Readers that extract or use data from Matroska AttachmentsSHOULDcheck that the data adheres to expectations or not use the attachement.¶
AMatroska Attachment with an inaccurate media type.¶
Damage to the Encryption and Compression fields (Section 14) that would result in bogus binary datainterpreted by the decoder.¶
Chapter Codecs running unwanted commands on the host system.¶
The same error handling done for EBML applies to Matroska files.Particular error handling is not covered in this specification, as this is depends on the goal of theMatroska Readers.It is up to the decision of theMatroska Readers on how to handle the errors if they are recoverable in their code or not.For example, if the checksum of the\Segment\Tracks is invalid, some could decide to try to read the data anyway,some will just reject the file, and most will not even check it.¶
Matroska Reader implementations need to be robust against malicious payloads; those that are related to denial of service are outlined inSection 2.1 of [RFC4732].¶
Although rarer, the same may apply to aMatroska Writer. Malicious stream datamust not cause the Matroska Writer to misbehave, as this might allow an attacker accessto transcoding gateways.¶
As an audio and visual container format, a Matroska file or stream willpotentially encapsulate numerous byte streams created with a variety ofcodecs. Implementers will need to consider the security considerations ofthese encapsulated formats.¶
This document creates a new IANA registry called the "Matroska Element IDs"registry.¶
To register a new Element ID in this registry, one needs an Element ID,a Change Controller (IETF or email of registrant), andan optional reference to a document describing the Element ID.¶
Element IDs are encodedusing the VINT mechanism described inSection 4 of [RFC8794] and can be betweenone and five octets long. Five-octet-long Element IDs are possibleonly if they are declared in the EBML header.¶
Element IDs are described inSection 5 of [RFC8794] with[Err7189] and[Err7191].¶
One-octet Matroska Element IDs are to be allocated according to the "RFC Required" policy[RFC8126].¶
Two-octet Matroska Element IDs are to be allocated according to the "Specification Required" policy[RFC8126].¶
Three-octet and four-octet Matroska Element IDs are to be allocated according to the "First Come First Served" policy[RFC8126].¶
The allowed values in the Matroska Element IDs registry are similar to the ones foundin the EBML Element IDs registry defined inSection 17.1 of [RFC8794].¶
EBML IDs defined for the EBML Header, as defined inSection 17.1 of [RFC8794],MUST NOT be used as Matroska Element IDs.¶
Given the scarcity of the one-octet Element IDs, they should only be created to save space for elements found many times in a file. For example, within a BlockGroup or Chapters. The four-octet Element IDs are mostly for synchronization of large elements.They should only be used for such high level elements.Elements that are not expected to be used often should use three-octet Element IDs.¶
Elements found inAppendix A have an assigned Matroska Element ID for historical reasons.These elements are not in use andSHOULD NOT be reused unless there is no other IDs available with the desired size.Such IDs are considered asreclaimed to the IANA registry, as they could be used for other things in the future.¶
Values of Matroska Element IDs found in this document are assigned as initial values as follows:¶
| Element ID | Element Name | Reference |
|---|---|---|
| 0x80 | ChapterDisplay | Described inSection 5.1.7.1.4.9 |
| 0x83 | TrackType | Described inSection 5.1.4.1.3 |
| 0x85 | ChapString | Described inSection 5.1.7.1.4.10 |
| 0x86 | CodecID | Described inSection 5.1.4.1.21 |
| 0x88 | FlagDefault | Described inSection 5.1.4.1.5 |
| 0x8E | Slices | Reclaimed (Appendix A.5) |
| 0x91 | ChapterTimeStart | Described inSection 5.1.7.1.4.3 |
| 0x92 | ChapterTimeEnd | Described inSection 5.1.7.1.4.4 |
| 0x96 | CueRefTime | Described inSection 5.1.5.1.2.8 |
| 0x97 | CueRefCluster | Reclaimed (Appendix A.37) |
| 0x98 | ChapterFlagHidden | Described inSection 5.1.7.1.4.5 |
| 0x9A | FlagInterlaced | Described inSection 5.1.4.1.28.1 |
| 0x9B | BlockDuration | Described inSection 5.1.3.5.3 |
| 0x9C | FlagLacing | Described inSection 5.1.4.1.12 |
| 0x9D | FieldOrder | Described inSection 5.1.4.1.28.2 |
| 0x9F | Channels | Described inSection 5.1.4.1.29.3 |
| 0xA0 | BlockGroup | Described inSection 5.1.3.5 |
| 0xA1 | Block | Described inSection 5.1.3.5.1 |
| 0xA2 | BlockVirtual | Reclaimed (Appendix A.3) |
| 0xA3 | SimpleBlock | Described inSection 5.1.3.4 |
| 0xA4 | CodecState | Described inSection 5.1.3.5.6 |
| 0xA5 | BlockAdditional | Described inSection 5.1.3.5.2.2 |
| 0xA6 | BlockMore | Described inSection 5.1.3.5.2.1 |
| 0xA7 | Position | Described inSection 5.1.3.2 |
| 0xAA | CodecDecodeAll | Reclaimed (Appendix A.22) |
| 0xAB | PrevSize | Described inSection 5.1.3.3 |
| 0xAE | TrackEntry | Described inSection 5.1.4.1 |
| 0xAF | EncryptedBlock | Reclaimed (Appendix A.15) |
| 0xB0 | PixelWidth | Described inSection 5.1.4.1.28.6 |
| 0xB2 | CueDuration | Described inSection 5.1.5.1.2.4 |
| 0xB3 | CueTime | Described inSection 5.1.5.1.1 |
| 0xB5 | SamplingFrequency | Described inSection 5.1.4.1.29.1 |
| 0xB6 | ChapterAtom | Described inSection 5.1.7.1.4 |
| 0xB7 | CueTrackPositions | Described inSection 5.1.5.1.2 |
| 0xB9 | FlagEnabled | Described inSection 5.1.4.1.4 |
| 0xBA | PixelHeight | Described inSection 5.1.4.1.28.7 |
| 0xBB | CuePoint | Described inSection 5.1.5.1 |
| 0xC0 | TrickTrackUID | Reclaimed (Appendix A.28) |
| 0xC1 | TrickTrackSegmentUID | Reclaimed (Appendix A.29) |
| 0xC4 | TrickMasterTrackSegmentUID | Reclaimed (Appendix A.32) |
| 0xC6 | TrickTrackFlag | Reclaimed (Appendix A.30) |
| 0xC7 | TrickMasterTrackUID | Reclaimed (Appendix A.31) |
| 0xC8 | ReferenceFrame | Reclaimed (Appendix A.12) |
| 0xC9 | ReferenceOffset | Reclaimed (Appendix A.13) |
| 0xCA | ReferenceTimestamp | Reclaimed (Appendix A.14) |
| 0xCB | BlockAdditionID | Reclaimed (Appendix A.9) |
| 0xCC | LaceNumber | Reclaimed (Appendix A.7) |
| 0xCD | FrameNumber | Reclaimed (Appendix A.8) |
| 0xCE | Delay | Reclaimed (Appendix A.10) |
| 0xCF | SliceDuration | Reclaimed (Appendix A.11) |
| 0xD7 | TrackNumber | Described inSection 5.1.4.1.1 |
| 0xDB | CueReference | Described inSection 5.1.5.1.2.7 |
| 0xE0 | Video | Described inSection 5.1.4.1.28 |
| 0xE1 | Audio | Described inSection 5.1.4.1.29 |
| 0xE2 | TrackOperation | Described inSection 5.1.4.1.30 |
| 0xE3 | TrackCombinePlanes | Described inSection 5.1.4.1.30.1 |
| 0xE4 | TrackPlane | Described inSection 5.1.4.1.30.2 |
| 0xE5 | TrackPlaneUID | Described inSection 5.1.4.1.30.3 |
| 0xE6 | TrackPlaneType | Described inSection 5.1.4.1.30.4 |
| 0xE7 | Timestamp | Described inSection 5.1.3.1 |
| 0xE8 | TimeSlice | Reclaimed (Appendix A.6) |
| 0xE9 | TrackJoinBlocks | Described inSection 5.1.4.1.30.5 |
| 0xEA | CueCodecState | Described inSection 5.1.5.1.2.6 |
| 0xEB | CueRefCodecState | Reclaimed (Appendix A.39) |
| 0xED | TrackJoinUID | Described inSection 5.1.4.1.30.6 |
| 0xEE | BlockAddID | Described inSection 5.1.3.5.2.3 |
| 0xF0 | CueRelativePosition | Described inSection 5.1.5.1.2.3 |
| 0xF1 | CueClusterPosition | Described inSection 5.1.5.1.2.2 |
| 0xF7 | CueTrack | Described inSection 5.1.5.1.2.1 |
| 0xFA | ReferencePriority | Described inSection 5.1.3.5.4 |
| 0xFB | ReferenceBlock | Described inSection 5.1.3.5.5 |
| 0xFD | ReferenceVirtual | Reclaimed (Appendix A.4) |
| 0x41A4 | BlockAddIDName | Described inSection 5.1.4.1.17.2 |
| 0x41E4 | BlockAdditionMapping | Described inSection 5.1.4.1.17 |
| 0x41E7 | BlockAddIDType | Described inSection 5.1.4.1.17.3 |
| 0x41ED | BlockAddIDExtraData | Described inSection 5.1.4.1.17.4 |
| 0x41F0 | BlockAddIDValue | Described inSection 5.1.4.1.17.1 |
| 0x4254 | ContentCompAlgo | Described inSection 5.1.4.1.31.6 |
| 0x4255 | ContentCompSettings | Described inSection 5.1.4.1.31.7 |
| 0x437C | ChapLanguage | Described inSection 5.1.7.1.4.11 |
| 0x437D | ChapLanguageBCP47 | Described inSection 5.1.7.1.4.12 |
| 0x437E | ChapCountry | Described inSection 5.1.7.1.4.13 |
| 0x4444 | SegmentFamily | Described inSection 5.1.2.7 |
| 0x4461 | DateUTC | Described inSection 5.1.2.11 |
| 0x447A | TagLanguage | Described inSection 5.1.8.1.2.2 |
| 0x447B | TagLanguageBCP47 | Described inSection 5.1.8.1.2.3 |
| 0x4484 | TagDefault | Described inSection 5.1.8.1.2.4 |
| 0x4485 | TagBinary | Described inSection 5.1.8.1.2.6 |
| 0x4487 | TagString | Described inSection 5.1.8.1.2.5 |
| 0x4489 | Duration | Described inSection 5.1.2.10 |
| 0x44B4 | TagDefaultBogus | Reclaimed (Appendix A.43) |
| 0x450D | ChapProcessPrivate | Described inSection 5.1.7.1.4.16 |
| 0x45A3 | TagName | Described inSection 5.1.8.1.2.1 |
| 0x45B9 | EditionEntry | Described inSection 5.1.7.1 |
| 0x45BC | EditionUID | Described inSection 5.1.7.1.1 |
| 0x45DB | EditionFlagDefault | Described inSection 5.1.7.1.2 |
| 0x45DD | EditionFlagOrdered | Described inSection 5.1.7.1.3 |
| 0x465C | FileData | Described inSection 5.1.6.1.4 |
| 0x4660 | FileMediaType | Described inSection 5.1.6.1.3 |
| 0x4661 | FileUsedStartTime | Reclaimed (Appendix A.41) |
| 0x4662 | FileUsedEndTime | Reclaimed (Appendix A.42) |
| 0x466E | FileName | Described inSection 5.1.6.1.2 |
| 0x4675 | FileReferral | Reclaimed (Appendix A.40) |
| 0x467E | FileDescription | Described inSection 5.1.6.1.1 |
| 0x46AE | FileUID | Described inSection 5.1.6.1.5 |
| 0x47E1 | ContentEncAlgo | Described inSection 5.1.4.1.31.9 |
| 0x47E2 | ContentEncKeyID | Described inSection 5.1.4.1.31.10 |
| 0x47E3 | ContentSignature | Reclaimed (Appendix A.33) |
| 0x47E4 | ContentSigKeyID | Reclaimed (Appendix A.34) |
| 0x47E5 | ContentSigAlgo | Reclaimed (Appendix A.35) |
| 0x47E6 | ContentSigHashAlgo | Reclaimed (Appendix A.36) |
| 0x47E7 | ContentEncAESSettings | Described inSection 5.1.4.1.31.11 |
| 0x47E8 | AESSettingsCipherMode | Described inSection 5.1.4.1.31.12 |
| 0x4D80 | MuxingApp | Described inSection 5.1.2.13 |
| 0x4DBB | Seek | Described inSection 5.1.1.1 |
| 0x5031 | ContentEncodingOrder | Described inSection 5.1.4.1.31.2 |
| 0x5032 | ContentEncodingScope | Described inSection 5.1.4.1.31.3 |
| 0x5033 | ContentEncodingType | Described inSection 5.1.4.1.31.4 |
| 0x5034 | ContentCompression | Described inSection 5.1.4.1.31.5 |
| 0x5035 | ContentEncryption | Described inSection 5.1.4.1.31.8 |
| 0x535F | CueRefNumber | Reclaimed (Appendix A.38) |
| 0x536E | Name | Described inSection 5.1.4.1.18 |
| 0x5378 | CueBlockNumber | Described inSection 5.1.5.1.2.5 |
| 0x537F | TrackOffset | Reclaimed (Appendix A.18) |
| 0x53AB | SeekID | Described inSection 5.1.1.1.1 |
| 0x53AC | SeekPosition | Described inSection 5.1.1.1.2 |
| 0x53B8 | StereoMode | Described inSection 5.1.4.1.28.3 |
| 0x53B9 | OldStereoMode | Described inSection 5.1.4.1.28.5 |
| 0x53C0 | AlphaMode | Described inSection 5.1.4.1.28.4 |
| 0x54AA | PixelCropBottom | Described inSection 5.1.4.1.28.8 |
| 0x54B0 | DisplayWidth | Described inSection 5.1.4.1.28.12 |
| 0x54B2 | DisplayUnit | Described inSection 5.1.4.1.28.14 |
| 0x54B3 | AspectRatioType | Reclaimed (Appendix A.24) |
| 0x54BA | DisplayHeight | Described inSection 5.1.4.1.28.13 |
| 0x54BB | PixelCropTop | Described inSection 5.1.4.1.28.9 |
| 0x54CC | PixelCropLeft | Described inSection 5.1.4.1.28.10 |
| 0x54DD | PixelCropRight | Described inSection 5.1.4.1.28.11 |
| 0x55AA | FlagForced | Described inSection 5.1.4.1.6 |
| 0x55AB | FlagHearingImpaired | Described inSection 5.1.4.1.7 |
| 0x55AC | FlagVisualImpaired | Described inSection 5.1.4.1.8 |
| 0x55AD | FlagTextDescriptions | Described inSection 5.1.4.1.9 |
| 0x55AE | FlagOriginal | Described inSection 5.1.4.1.10 |
| 0x55AF | FlagCommentary | Described inSection 5.1.4.1.11 |
| 0x55B0 | Colour | Described inSection 5.1.4.1.28.16 |
| 0x55B1 | MatrixCoefficients | Described inSection 5.1.4.1.28.17 |
| 0x55B2 | BitsPerChannel | Described inSection 5.1.4.1.28.18 |
| 0x55B3 | ChromaSubsamplingHorz | Described inSection 5.1.4.1.28.19 |
| 0x55B4 | ChromaSubsamplingVert | Described inSection 5.1.4.1.28.20 |
| 0x55B5 | CbSubsamplingHorz | Described inSection 5.1.4.1.28.21 |
| 0x55B6 | CbSubsamplingVert | Described inSection 5.1.4.1.28.22 |
| 0x55B7 | ChromaSitingHorz | Described inSection 5.1.4.1.28.23 |
| 0x55B8 | ChromaSitingVert | Described inSection 5.1.4.1.28.24 |
| 0x55B9 | Range | Described inSection 5.1.4.1.28.25 |
| 0x55BA | TransferCharacteristics | Described inSection 5.1.4.1.28.26 |
| 0x55BB | Primaries | Described inSection 5.1.4.1.28.27 |
| 0x55BC | MaxCLL | Described inSection 5.1.4.1.28.28 |
| 0x55BD | MaxFALL | Described inSection 5.1.4.1.28.29 |
| 0x55D0 | MasteringMetadata | Described inSection 5.1.4.1.28.30 |
| 0x55D1 | PrimaryRChromaticityX | Described inSection 5.1.4.1.28.31 |
| 0x55D2 | PrimaryRChromaticityY | Described inSection 5.1.4.1.28.32 |
| 0x55D3 | PrimaryGChromaticityX | Described inSection 5.1.4.1.28.33 |
| 0x55D4 | PrimaryGChromaticityY | Described inSection 5.1.4.1.28.34 |
| 0x55D5 | PrimaryBChromaticityX | Described inSection 5.1.4.1.28.35 |
| 0x55D6 | PrimaryBChromaticityY | Described inSection 5.1.4.1.28.36 |
| 0x55D7 | WhitePointChromaticityX | Described inSection 5.1.4.1.28.37 |
| 0x55D8 | WhitePointChromaticityY | Described inSection 5.1.4.1.28.38 |
| 0x55D9 | LuminanceMax | Described inSection 5.1.4.1.28.39 |
| 0x55DA | LuminanceMin | Described inSection 5.1.4.1.28.40 |
| 0x55EE | MaxBlockAdditionID | Described inSection 5.1.4.1.16 |
| 0x5654 | ChapterStringUID | Described inSection 5.1.7.1.4.2 |
| 0x56AA | CodecDelay | Described inSection 5.1.4.1.25 |
| 0x56BB | SeekPreRoll | Described inSection 5.1.4.1.26 |
| 0x5741 | WritingApp | Described inSection 5.1.2.14 |
| 0x5854 | SilentTracks | Reclaimed (Appendix A.1) |
| 0x58D7 | SilentTrackNumber | Reclaimed (Appendix A.2) |
| 0x61A7 | AttachedFile | Described inSection 5.1.6.1 |
| 0x6240 | ContentEncoding | Described inSection 5.1.4.1.31.1 |
| 0x6264 | BitDepth | Described inSection 5.1.4.1.29.4 |
| 0x63A2 | CodecPrivate | Described inSection 5.1.4.1.22 |
| 0x63C0 | Targets | Described inSection 5.1.8.1.1 |
| 0x63C3 | ChapterPhysicalEquiv | Described inSection 5.1.7.1.4.8 |
| 0x63C4 | TagChapterUID | Described inSection 5.1.8.1.1.5 |
| 0x63C5 | TagTrackUID | Described inSection 5.1.8.1.1.3 |
| 0x63C6 | TagAttachmentUID | Described inSection 5.1.8.1.1.6 |
| 0x63C9 | TagEditionUID | Described inSection 5.1.8.1.1.4 |
| 0x63CA | TargetType | Described inSection 5.1.8.1.1.2 |
| 0x6624 | TrackTranslate | Described inSection 5.1.4.1.27 |
| 0x66A5 | TrackTranslateTrackID | Described inSection 5.1.4.1.27.1 |
| 0x66BF | TrackTranslateCodec | Described inSection 5.1.4.1.27.2 |
| 0x66FC | TrackTranslateEditionUID | Described inSection 5.1.4.1.27.3 |
| 0x67C8 | SimpleTag | Described inSection 5.1.8.1.2 |
| 0x68CA | TargetTypeValue | Described inSection 5.1.8.1.1.1 |
| 0x6911 | ChapProcessCommand | Described inSection 5.1.7.1.4.17 |
| 0x6922 | ChapProcessTime | Described inSection 5.1.7.1.4.18 |
| 0x6924 | ChapterTranslate | Described inSection 5.1.2.8 |
| 0x6933 | ChapProcessData | Described inSection 5.1.7.1.4.19 |
| 0x6944 | ChapProcess | Described inSection 5.1.7.1.4.14 |
| 0x6955 | ChapProcessCodecID | Described inSection 5.1.7.1.4.15 |
| 0x69A5 | ChapterTranslateID | Described inSection 5.1.2.8.1 |
| 0x69BF | ChapterTranslateCodec | Described inSection 5.1.2.8.2 |
| 0x69FC | ChapterTranslateEditionUID | Described inSection 5.1.2.8.3 |
| 0x6D80 | ContentEncodings | Described inSection 5.1.4.1.31 |
| 0x6DE7 | MinCache | Reclaimed (Appendix A.16) |
| 0x6DF8 | MaxCache | Reclaimed (Appendix A.17) |
| 0x6E67 | ChapterSegmentUUID | Described inSection 5.1.7.1.4.6 |
| 0x6EBC | ChapterSegmentEditionUID | Described inSection 5.1.7.1.4.7 |
| 0x6FAB | TrackOverlay | Reclaimed (Appendix A.23) |
| 0x7373 | Tag | Described inSection 5.1.8.1 |
| 0x7384 | SegmentFilename | Described inSection 5.1.2.2 |
| 0x73A4 | SegmentUUID | Described inSection 5.1.2.1 |
| 0x73C4 | ChapterUID | Described inSection 5.1.7.1.4.1 |
| 0x73C5 | TrackUID | Described inSection 5.1.4.1.2 |
| 0x7446 | AttachmentLink | Described inSection 5.1.4.1.24 |
| 0x75A1 | BlockAdditions | Described inSection 5.1.3.5.2 |
| 0x75A2 | DiscardPadding | Described inSection 5.1.3.5.7 |
| 0x7670 | Projection | Described inSection 5.1.4.1.28.41 |
| 0x7671 | ProjectionType | Described inSection 5.1.4.1.28.42 |
| 0x7672 | ProjectionPrivate | Described inSection 5.1.4.1.28.43 |
| 0x7673 | ProjectionPoseYaw | Described inSection 5.1.4.1.28.44 |
| 0x7674 | ProjectionPosePitch | Described inSection 5.1.4.1.28.45 |
| 0x7675 | ProjectionPoseRoll | Described inSection 5.1.4.1.28.46 |
| 0x78B5 | OutputSamplingFrequency | Described inSection 5.1.4.1.29.2 |
| 0x7BA9 | Title | Described inSection 5.1.2.12 |
| 0x7D7B | ChannelPositions | Reclaimed (Appendix A.27) |
| 0x22B59C | Language | Described inSection 5.1.4.1.19 |
| 0x22B59D | LanguageBCP47 | Described inSection 5.1.4.1.20 |
| 0x23314F | TrackTimestampScale | Described inSection 5.1.4.1.15 |
| 0x234E7A | DefaultDecodedFieldDuration | Described inSection 5.1.4.1.14 |
| 0x2383E3 | FrameRate | Reclaimed (Appendix A.26) |
| 0x23E383 | DefaultDuration | Described inSection 5.1.4.1.13 |
| 0x258688 | CodecName | Described inSection 5.1.4.1.23 |
| 0x26B240 | CodecDownloadURL | Reclaimed (Appendix A.21) |
| 0x2AD7B1 | TimestampScale | Described inSection 5.1.2.9 |
| 0x2EB524 | UncompressedFourCC | Described inSection 5.1.4.1.28.15 |
| 0x2FB523 | GammaValue | Reclaimed (Appendix A.25) |
| 0x3A9697 | CodecSettings | Reclaimed (Appendix A.19) |
| 0x3B4040 | CodecInfoURL | Reclaimed (Appendix A.20) |
| 0x3C83AB | PrevFilename | Described inSection 5.1.2.4 |
| 0x3CB923 | PrevUUID | Described inSection 5.1.2.3 |
| 0x3E83BB | NextFilename | Described inSection 5.1.2.6 |
| 0x3EB923 | NextUUID | Described inSection 5.1.2.5 |
| 0x1043A770 | Chapters | Described inSection 5.1.7 |
| 0x114D9B74 | SeekHead | Described inSection 5.1.1 |
| 0x1254C367 | Tags | Described inSection 5.1.8 |
| 0x1549A966 | Info | Described inSection 5.1.2 |
| 0x1654AE6B | Tracks | Described inSection 5.1.4 |
| 0x18538067 | Segment | Described inSection 5.1 |
| 0x1941A469 | Attachments | Described inSection 5.1.6 |
| 0x1C53BB6B | Cues | Described inSection 5.1.5 |
| 0x1F43B675 | Cluster | Described inSection 5.1.3 |
This document creates a new IANA registry called the "Matroska Chapter Codec IDs" registry.The values correspond to the unsigned integerChapProcessCodecID value described inSection 5.1.7.1.4.15.¶
To register a new Chapter Codec ID in this registry, one needs a Chapter Codec ID,a Change Controller (IETF or email of registrant), andan optional reference to a document describing the Chapter Codec ID.¶
The Chapter Codec IDs are to be allocated according to the "First Come First Served" policy[RFC8126].¶
ChapProcessCodecID values of "0" and "1" are RESERVED to the IETF for future use.¶
Matroska files and streams are found in three main forms: audio-video files, audio-only, and occasionally with stereoscopic video tracks.¶
Historically, Matroska files and streams have used the following media types with an "x-" prefix.For better compatibility, a systemSHOULD be able to handle both formats.Newer systemsSHOULD NOT use the historic format and use the format that follows the[RFC6838] format instead.¶
Please register three media types, the[RFC6838] templates are below:¶
Since Matroska has evolved since 2002, many parts that were considered for use in the format were never used and often incorrectly designed. Many of the elements that were defined then are not found in any known files, but were part of public specs. DivX also had a few custom elements that were designed for custom features.¶
We list these elements that have a known ID thatSHOULD NOT be reused to avoid colliding with existing files. They might be reassigned by IANA in the future if there are no more IDs for a given size. A short description of what each ID was used for is included, but the text is not normative.¶
\Segment\Cluster\BlockGroup\Slices\TimeSlice\Delay¶\Segment\Cluster\BlockGroup\Slices\TimeSlice\SliceDuration¶\Segment\Cluster\BlockGroup\ReferenceFrame¶\Segment\Cluster\BlockGroup\ReferenceFrame\ReferenceOffset¶\Segment\Cluster\BlockGroup\ReferenceFrame\ReferenceTimestamp¶\Segment\Cluster\EncryptedBlock¶\Segment\Tracks\TrackEntry\TrackOffset¶\Segment\Tracks\TrackEntry\TrackOverlay¶\Segment\Tracks\TrackEntry\TrickTrackUID¶\Segment\Tracks\TrackEntry\TrickTrackSegmentUID¶\Segment\Tracks\TrackEntry\TrickTrackFlag¶\Segment\Tracks\TrackEntry\TrickMasterTrackUID¶\Segment\Tracks\TrackEntry\TrickMasterTrackSegmentUID¶\Segment\Attachments\AttachedFile\FileUsedStartTime¶\Segment\Attachments\AttachedFile\FileUsedEndTime¶\Segment\Tags\Tag\+SimpleTag\TagDefaultBogus¶