Back to top

Specifications

Status of this document

This document is not the real format specification. It's a simple draft to work. (For a simplified diagram of the layout of a Matroska file, see the Diagram page.) But since it's quite complete it is used as a reference for the development of libmatroska. An alternate version of the specification can be found here (PDF doc maintained by Alexander Noé -- may be outdated).

A more accurate and in-depth for Matroska is being done via the IETF CELLAR group. EBML is also specified more officially this way. There is a github repo with the speciciations in progress for Matroska and EBML. The official mailing list for CELLAR can be found on the IETF website. Anything found there takes precedence over the specifications found in this page.

The table found below is now generated from the "source" of the Matroska specification. This XML file is also used to generate the semantic data used in libmatroska and libmatroska2. We encourage anyone to use and monitor its changes so your code is spec-proof and always up to date.

Note that versions 1, 2 and 3 have been finalized. Version 4 is currently work in progress. There may be further additions to v4.

EBML principle

EBML is short for Extensible Binary Meta Language. EBML specifies a binary and octet (byte) aligned format inspired by the principle of XML. EBML itself is a generalized description of the technique of binary markup. Like XML, it is completely agnostic to any data that it might contain. Therein, the Matroska project is a specific implementation using the rules of EBML: It seeks to define a subset of the EBML language in the context of audio and video data (though it obviously isn't limited to this purpose). The format is made of 2 parts: the semantic and the syntax. The semantic specifies a number of IDs and their basic type and is not included in the data file/stream. There is a specific project dealing with EBML in more details and more recent updates.

Just like XML, the specific "tags" (IDs in EBML parlance) used in an EBML implementation are arbitrary. However, the semantic of EBML outlines general data types and ID's.

The known basic types are:

  • Signed Integer - Big-endian, any size from 1 to 8 octets
  • Unsigned Integer - Big-endian, any size from 1 to 8 octets
  • Float - Big-endian, defined for 4 and 8 octets (32, 64 bits)
  • String - Printable ASCII (0x20 to 0x7E), zero-padded when needed
  • UTF-8 - Unicode string, zero padded when needed (RFC 2279)
  • Date - signed 8 octets integer in nanoseconds with 0 indicating the precise beginning of the millennium (at 2001-01-01T00:00:00,000000000 UTC)
  • Master-Element - contains other EBML sub-elements of the next lower level
  • Binary - not interpreted by the parser

As well as defining standard data types, EBML uses a system of Elements to make up an EBML "document." Elements incorporate an Element ID, a descriptor for the size of the element, and the binary data itself. Futher, Elements can be nested, or contain, Elements of a lower "level."

Element IDs (also called EBML IDs) are outlined as follows, beginning with the ID itself, followed by the Data Size, and then the non-interpreted Binary itself:

  • Element ID coded with an UTF-8 like system :
    bits, big-endian
    1xxx xxxx                                  - Class A IDs (2^7 -1 possible values) (base 0x8X)
    01xx xxxx  xxxx xxxx                       - Class B IDs (2^14-1 possible values) (base 0x4X 0xXX)
    001x xxxx  xxxx xxxx  xxxx xxxx            - Class C IDs (2^21-1 possible values) (base 0x2X 0xXX 0xXX)
    0001 xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx - Class D IDs (2^28-1 possible values) (base 0x1X 0xXX 0xXX 0xXX)
    
    Some Notes:
    • The leading bits of the EBML IDs are used to identify the length of the ID. The number of leading 0's + 1 is the length of the ID in octets. We will refer to the leading bits as the Length Descriptor.
    • Any ID where all x's are composed entirely of 1's is a Reserved ID, thus the -1 in the definitions above.
    • The Reserved IDs (all x set to 1) are the only IDs that may change the Length Descriptor.


  • Data size, in octets, is also coded with an UTF-8 like system :
    bits, big-endian
    1xxx xxxx                                                                              - value 0 to  2^7-2
    01xx xxxx  xxxx xxxx                                                                   - value 0 to 2^14-2
    001x xxxx  xxxx xxxx  xxxx xxxx                                                        - value 0 to 2^21-2
    0001 xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                             - value 0 to 2^28-2
    0000 1xxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                  - value 0 to 2^35-2
    0000 01xx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                       - value 0 to 2^42-2
    0000 001x  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx            - value 0 to 2^49-2
    0000 0001  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx - value 0 to 2^56-2
    

    Since modern computers do not easily deal with data coded in sizes greater than 64 bits, any larger Element Sizes are left undefined at the moment. Currently, the Element Size coding allows for an Element to grow to 72000 To, i.e. 7x10^16 octets or 72000 terabytes, which will be sufficient for the time being.

    There is only one reserved word for Element Size encoding, which is an Element Size encoded to all 1's. Such a coding indicates that the size of the Element is unknown, which is a special case that we believe will be useful for live streaming purposes. However, avoid using this reserved word unnecessarily, because it makes parsing slower and more difficult to implement.

  • Data
    • Integers are stored in their standard big-endian form (no UTF-like encoding), only the size may differ from their usual form (24 or 40 bits for example).
    • The Signed Integer is just the big-endian representation trimmed from some 0x00 and 0xFF where they are not meaningful (sign). For example -2 can be coded as 0xFFFFFFFFFFFFFE or 0xFFFE or 0xFE and 5 can be coded 0x000000000005 or 0x0005 or 0x05.

Elements semantic

A more detailed description of the column headers can be found in the Specification Notes.

If you are interrested in WebM you can have a look at this page that describes what parts of Matroska it kept.

  • Element Name - The full name of the described element.
  • L - Level - The level within an EBML tree that the element may occur at. + is for a recursive level (can be its own child). g: global element (can be found at any level)
  • EBML ID - The Element ID displayed as octets.
  • Ma - Mandatory - This element is mandatory in the file (abbreviated as »mand.«).
  • Mu - Multiple - The element may appear multiple times within its parent element (abbreviated as »mult.«).
  • Rng - Range - Valid range of values to store in the element.
  • Default - The default value of the element.
  • T - Element Type - The form of data the element contains. m: Master, u: unsigned int, i: signed integer, s: string, 8: UTF-8 string, b: binary, f: float, d: date
  • 1 - The element is contained in Matroska version 1.
  • 2 - The element is contained in Matroska version 2.
  • 3 - The element is contained in Matroska version 3.
  • 4 - The element is contained in Matroska version 4 (v4 is still work in progress; further additions are possible).
  • W - All elements available for use in WebM.
  • Description - A short description of the element's purpose.

The default values defined for the EBML header correspond to the values for a Matroska stream/file. When parsing the EBML header the default values are different, irrespective of the DocType defined.

  • EBMLMaxIDLength is 4: IDs in the EBML header cannot be longer than 4 octets.
  • EBMLMaxSizeLength is 4: Length of IDs in the EBML header cannot be longer than 4 octets.
EBMLMaxIDLength 1 [42][F2] mand. - 4 4 u
EBMLMaxSizeLength 1 [42][F3] mand. - 1-8 8 u
Element Name L EBML ID Ma Mu Rng Default T 1 2 3 4 W Description
Segment
Segment 0 [18][53][80][67] mand. - - - m * * * * * The Root Element that contains all other Top-Level Elements (Elements defined only at Level 1). A Matroska file is composed of 1 Segment.
Element Name L EBML ID Ma Mu Rng Default T 1 2 3 4 W Description
Meta Seek Information
SeekHead 1 [11][4D][9B][74] - mult. - - m * * * * * Contains the Segment Position of other Top-Level Elements.
Seek 2 [4D][BB] mand. mult. - - m * * * * * Contains a single seek entry to an EBML Element.
SeekID 3 [53][AB] mand. - - - b * * * * * The binary ID corresponding to the Element name.
SeekPosition 3 [53][AC] mand. - - - u * * * * * The Segment Position of the Element.
Element Name L EBML ID Ma Mu Rng Default T 1 2 3 4 W Description
Segment Information
Info 1 [15][49][A9][66] mand. mult. - - m * * * * * Contains general information about the Segment.
SegmentUID 2 [73][A4] - - not 0 - b * * * * If the Segment is a part of a Linked Segment then this Element is REQUIRED.
SegmentFilename 2 [73][84] - - - - 8 * * * * A filename corresponding to this Segment.
PrevUID 2 [3C][B9][23] - - - - b * * * * If the Segment is a part of a Linked Segment that uses Hard Linking then either the PrevUID or the NextUID Element is REQUIRED. If a Segment contains a PrevUID but not a NextUID then it MAY be considered as the last Segment of the Linked Segment. The PrevUID MUST NOT be equal to the SegmentUID.
PrevFilename 2 [3C][83][AB] - - - - 8 * * * * Provision of the previous filename is for display convenience, but PrevUID SHOULD be considered authoritative for identifying the previous Segment in a Linked Segment.
NextUID 2 [3E][B9][23] - - - - b * * * * If the Segment is a part of a Linked Segment that uses Hard Linking then either the PrevUID or the NextUID Element is REQUIRED. If a Segment contains a NextUID but not a PrevUID then it MAY be considered as the first Segment of the Linked Segment. The NextUID MUST NOT be equal to the SegmentUID.
NextFilename 2 [3E][83][BB] - - - - 8 * * * * Provision of the next filename is for display convenience, but NextUID SHOULD be considered authoritative for identifying the Next Segment.
SegmentFamily 2 [44][44] - mult. - - b * * * * If the Segment is a part of a Linked Segment that uses Soft Linking then this Element is REQUIRED.
ChapterTranslate 2 [69][24] - mult. - - m * * * * A tuple of corresponding ID used by chapter codecs to represent this Segment.
ChapterTranslateEditionUID 3 [69][FC] - mult. - - u * * * * Specify an edition UID on which this correspondence applies. When not specified, it means for all editions found in the Segment.
ChapterTranslateCodec 3 [69][BF] mand. - - - u * * * * The chapter codec
0 - Matroska Script,
1 - DVD-menu
ChapterTranslateID 3 [69][A5] mand. - - - b * * * * The binary value used to represent this Segment in the chapter codec data. The format depends on the ChapProcessCodecID used.
TimestampScale 2 [2A][D7][B1] mand. - not 0 1000000 u * * * * * Timestamp scale in nanoseconds (1.000.000 means all timestamps in the Segment are expressed in milliseconds).
Duration 2 [44][89] - - > 0x0p+0 - f * * * * * Duration of the Segment in nanoseconds based on TimestampScale.
DateUTC 2 [44][61] - - - - d * * * * * The date and time that the Segment was created by the muxing application or library.
Title 2 [7B][A9] - - - - 8 * * * * General name of the Segment.
MuxingApp 2 [4D][80] mand. - - - 8 * * * * * Include the full name of the application or library followed by the version number.
WritingApp 2 [57][41] mand. - - - 8 * * * * * Include the full name of the application followed by the version number.
Element Name L EBML ID Ma Mu Rng Default T 1 2 3 4 W Description
Cluster
Cluster 1 [1F][43][B6][75] - mult. - - m * * * * * The Top-Level Element containing the (monolithic) Block structure.
Timestamp 2 [E7] mand. - - - u * * * * * Absolute timestamp of the cluster (based on TimestampScale).
SilentTracks 2 [58][54] - - - - m * * * * The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking or to decide what track to use.
SilentTrackNumber 3 [58][D7] - mult. - - u * * * * One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster.
Position 2 [A7] - - - - u * * * * The Segment Position of the Cluster in the Segment (0 in live streams). It might help to resynchronise offset on damaged streams.
PrevSize 2 [AB] - - - - u * * * * * Size of the previous Cluster, in octets. Can be useful for backward playing.
SimpleBlock 2 [A3] - mult. - - b * * * * Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed. (see SimpleBlock Structure)
BlockGroup 2 [A0] - mult. - - m * * * * * Basic container of information containing a single Block and information specific to that Block.
Block 3 [A1] mand. - - - b * * * * * Block containing the actual data to be rendered and a timestamp relative to the Cluster Timestamp. (see Block Structure)
BlockVirtual 3 [A2] - - - - b A Block with no data. It MUST be stored in the stream at the place the real Block would be in display order. (see Block Virtual)
BlockAdditions 3 [75][A1] - - - - m * * * * Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data.
BlockMore 4 [A6] mand. mult. - - m * * * * Contain the BlockAdditional and some parameters.
BlockAddID 5 [EE] mand. - not 0 1 u * * * * An ID to identify the BlockAdditional level.
BlockAdditional 5 [A5] mand. - - - b * * * * Interpreted by the codec as it wishes (using the BlockAddID).
BlockDuration 3 [9B] - - - DefaultDuration u * * * * * The duration of the Block (based on TimestampScale). This Element is mandatory when DefaultDuration is set for the track (but can be omitted as other default values). 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). This Element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks.
ReferencePriority 3 [FA] mand. - - 0 u * * * * This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced.
ReferenceBlock 3 [FB] - mult. - - i * * * * * Timestamp of another frame used as a reference (ie: B or P frame). The timestamp is relative to the block it's attached to.
ReferenceVirtual 3 [FD] - - - - i The Segment Position of the data that would otherwise be in position of the virtual block.
CodecState 3 [A4] - - - - b * * * The new codec state to use. Data interpretation is private to the codec. This information SHOULD always be referenced by a seek entry.
DiscardPadding 3 [75][A2] - - - - i * * Duration in nanoseconds of the silent data added to the Block (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and SHOULD be discarded during playback.
Slices 3 [8E] - - - - m * * * * * Contains slices description.
TimeSlice 4 [E8] - mult. - - m * * Contains extra time information about the data contained in the Block. Being able to interpret this Element is not REQUIRED for playback.
LaceNumber 5 [CC] - - - 0 u * * The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). Being able to interpret this Element is not REQUIRED for playback.
FrameNumber 5 [CD] - - - 0 u The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame).
BlockAdditionID 5 [CB] - - - 0 u The ID of the BlockAdditional Element (0 is the main Block).
Delay 5 [CE] - - - 0 u The (scaled) delay to apply to the Element.
SliceDuration 5 [CF] - - - 0 u The (scaled) duration to apply to the Element.
ReferenceFrame 3 [C8] - - - - m DivX trick track extensions
ReferenceOffset 4 [C9] mand. - - - u DivX trick track extensions
ReferenceTimestamp 4 [CA] mand. - - - u DivX trick track extensions
EncryptedBlock 2 [AF] - mult. - - b Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed). (see EncryptedBlock Structure)
Element Name L EBML ID Ma Mu Rng Default T 1 2 3 4 W Description
Track
Tracks 1 [16][54][AE][6B] - mult. - - m * * * * * A Top-Level Element of information with many tracks described.
TrackEntry 2 [AE] mand. mult. - - m * * * * * Describes a track with all Elements.
TrackNumber 3 [D7] mand. - not 0 - u * * * * * The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number).
TrackUID 3 [73][C5] mand. - not 0 - u * * * * * A unique ID to identify the Track. This SHOULD be kept the same when making a direct stream copy of the Track to another file.
TrackType 3 [83] mand. - 1-254 - u * * * * * A set of track types coded on 8 bits.
1 - video,
2 - audio,
3 - complex,
16 - logo,
17 - subtitle,
18 - buttons,
32 - control
FlagEnabled 3 [B9] mand. - 0-1 1 u * * * * Set if the track is usable. (1 bit)
FlagDefault 3 [88] mand. - 0-1 1 u * * * * * Set if that track (audio, video or subs) SHOULD be active if no language found matches the user preference. (1 bit)
FlagForced 3 [55][AA] mand. - 0-1 0 u * * * * * Set if that track MUST be active during playback. There can be many forced track for a kind (audio, video or subs), the player SHOULD select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. (1 bit)
FlagLacing 3 [9C] mand. - 0-1 1 u * * * * * Set if the track MAY contain blocks using lacing. (1 bit)
MinCache 3 [6D][E7] mand. - - 0 u * * * * The minimum number of frames a player SHOULD be able to cache during playback. If set to 0, the reference pseudo-cache system is not used.
MaxCache 3 [6D][F8] - - - - u * * * * The maximum cache size necessary to store referenced frames in and the current frame. 0 means no cache is needed.
DefaultDuration 3 [23][E3][83] - - not 0 - u * * * * * Number of nanoseconds (not scaled via TimestampScale) per frame ('frame' in the Matroska sense -- one Element put into a (Simple)Block).
DefaultDecodedFieldDuration 3 [23][4E][7A] - - not 0 - u * The period in nanoseconds (not scaled by TimestampScale) between two successive fields at the output of the decoding process (see the notes)
TrackTimestampScale 3 [23][31][4F] mand. - > 0x0p+0 1.0 f * * * DEPRECATED, DO NOT USE. The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs).
TrackOffset 3 [53][7F] - - - 0 i A value to add to the Block's Timestamp. This can be used to adjust the playback offset of a track.
MaxBlockAdditionID 3 [55][EE] mand. - - 0 u * * * * The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track.
Name 3 [53][6E] - - - - 8 * * * * * A human-readable track name.
Language 3 [22][B5][9C] - - - eng s * * * * * Specifies the language of the track in the Matroska languages form. This Element MUST be ignored if the LanguageIETF Element is used in the same TrackEntry.
LanguageIETF 3 [22][B5][9D] - - - - s * Specifies the language of the track according to BCP 47 and using the IANA Language Subtag Registry. If this Element is used, then any Language Elements used in the same TrackEntry MUST be ignored.
CodecID 3 [86] mand. - - - s * * * * * An ID corresponding to the codec, see the codec page for more info.
CodecPrivate 3 [63][A2] - - - - b * * * * * Private data only known to the codec.
CodecName 3 [25][86][88] - - - - 8 * * * * * A human-readable string specifying the codec.
CodecSettings 3 [3A][96][97] - - - - 8 A string describing the encoding setting used.
CodecInfoURL 3 [3B][40][40] - mult. - - s A URL to find information about the codec used.
CodecDownloadURL 3 [26][B2][40] - mult. - - s A URL to download about the codec used.
CodecDecodeAll 3 [AA] mand. - 0-1 1 u * * * The codec can decode potentially damaged data (1 bit).
TrackOverlay 3 [6F][AB] - mult. - - u * * * * Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track SHOULD be used instead. The order of multiple TrackOverlay matters, the first one is the one that SHOULD be used. If not found it SHOULD be the second, etc.
CodecDelay 3 [56][AA] - - - 0 u * * CodecDelay is The codec-built-in delay in nanoseconds. This value MUST be subtracted from each block timestamp in order to get the actual timestamp. The value SHOULD be small so the muxing of tracks with the same actual timestamp are in the same Cluster.
SeekPreRoll 3 [56][BB] mand. - - 0 u * * After a discontinuity, SeekPreRoll is the duration in nanoseconds of the data the decoder MUST decode before the decoded data is valid.
TrackTranslate 3 [66][24] - mult. - - m * * * * The track identification for the given Chapter Codec.
TrackTranslateEditionUID 4 [66][FC] - mult. - - u * * * * Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the Segment.
TrackTranslateCodec 4 [66][BF] mand. - - - u * * * * The chapter codec.
0 - Matroska Script,
1 - DVD-menu
TrackTranslateTrackID 4 [66][A5] mand. - - - b * * * * The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used.
Video 3 [E0] - - - - m * * * * * Video settings.
FlagInterlaced 4 [9A] mand. - 0-2 0 u * * * * A flag to declare if the video is known to be progressive or interlaced and if applicable to declare details about the interlacement.
0 - undetermined,
1 - interlaced,
2 - progressive
FieldOrder 4 [9D] mand. - 0-14 2 u * Declare the field ordering of the video. If FlagInterlaced is not set to 1, this Element MUST be ignored.
0 - progressive,
1 - tff,
2 - undetermined,
6 - bff,
9 - bff(swapped),
14 - tff(swapped)
StereoMode 4 [53][B8] - - - 0 u * * * Stereo-3D video mode. There are some more details on 3D support in the Specification Notes.
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)
AlphaMode 4 [53][C0] - - - 0 u * * * Alpha Video Mode. Presence of this Element indicates that the BlockAdditional Element could contain Alpha data.
OldStereoMode 4 [53][B9] - - - - u DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska.
0 - mono,
1 - right eye,
2 - left eye,
3 - both eyes
PixelWidth 4 [B0] mand. - not 0 - u * * * * * Width of the encoded video frames in pixels.
PixelHeight 4 [BA] mand. - not 0 - u * * * * * Height of the encoded video frames in pixels.
PixelCropBottom 4 [54][AA] - - - 0 u * * * * * The number of video pixels to remove at the bottom of the image.
PixelCropTop 4 [54][BB] - - - 0 u * * * * * The number of video pixels to remove at the top of the image.
PixelCropLeft 4 [54][CC] - - - 0 u * * * * * The number of video pixels to remove on the left of the image.
PixelCropRight 4 [54][DD] - - - 0 u * * * * * The number of video pixels to remove on the right of the image.
DisplayWidth 4 [54][B0] - - not 0 PixelWidth - PixelCropLeft - Pi u * * * * * Width of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements). The default value is only valid when DisplayUnit is 0.
DisplayHeight 4 [54][BA] - - not 0 PixelHeight - PixelCropTop - Pi u * * * * * Height of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements). The default value is only valid when DisplayUnit is 0.
DisplayUnit 4 [54][B2] - - - 0 u * * * * * How DisplayWidth & DisplayHeight are interpreted.
0 - pixels,
1 - centimeters,
2 - inches,
3 - display aspect ratio,
4 - unknown
AspectRatioType 4 [54][B3] - - - 0 u * * * * * Specify the possible modifications to the aspect ratio.
0 - free resizing,
1 - keep aspect ratio,
2 - fixed
ColourSpace 4 [2E][B5][24] - - - - b * * * * Specify the pixel format used for the Track's data as a FourCC. This value is similar in scope to the biCompression value of AVI's BITMAPINFOHEADER. This Element is MANDATORY in TrackEntry when the CodecID Element of the TrackEntry is set to "V_UNCOMPRESSED".
GammaValue 4 [2F][B5][23] - - > 0x0p+0 - f Gamma Value.
FrameRate 4 [23][83][E3] - - > 0x0p+0 - f Number of frames per second. rong> only.
Colour 4 [55][B0] - - - - m * Settings describing the colour format.
MatrixCoefficients 5 [55][B1] - - - 2 u * The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273.
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
BitsPerChannel 5 [55][B2] - - - 0 u * Number of decoded bits per channel. A value of 0 indicates that the BitsPerChannel is unspecified.
ChromaSubsamplingHorz 5 [55][B3] - - - - u * The amount of pixels to remove in the Cr and Cb channels for every pixel not removed horizontally. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingHorz SHOULD be set to 1.
ChromaSubsamplingVert 5 [55][B4] - - - - u * The amount of pixels to remove in the Cr and Cb channels for every pixel not removed vertically. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingVert SHOULD be set to 1.
CbSubsamplingHorz 5 [55][B5] - - - - u * The amount of pixels to remove in the Cb channel for every pixel not removed horizontally. This is additive with ChromaSubsamplingHorz. Example: For video with 4:2:1 chroma subsampling, the ChromaSubsamplingHorz SHOULD be set to 1 and CbSubsamplingHorz SHOULD be set to 1.
CbSubsamplingVert 5 [55][B6] - - - - u * The amount of pixels to remove in the Cb channel for every pixel not removed vertically. This is additive with ChromaSubsamplingVert.
ChromaSitingHorz 5 [55][B7] - - - 0 u * How chroma is subsampled horizontally.
0 - unspecified,
1 - left collocated,
2 - half
ChromaSitingVert 5 [55][B8] - - - 0 u * How chroma is subsampled vertically.
0 - unspecified,
1 - top collocated,
2 - half
Range 5 [55][B9] - - - 0 u * Clipping of the color ranges.
0 - unspecified,
1 - broadcast range,
2 - full range (no clipping),
3 - defined by MatrixCoefficients/TransferCharacteristics
TransferCharacteristics 5 [55][BA] - - - 2 u * The transfer characteristics of the video. For clarity, the value and meanings for TransferCharacteristics are adopted from Table 3 of ISO/IEC 23091-4 or ITU-T H.273.
0 - reserved,
1 - ITU-R BT.709,
2 - unspecified,
3 - reserved,
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)
Primaries 5 [55][BB] - - - 2 u * The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273.
0 - reserved,
1 - ITU-R BT.709,
2 - unspecified,
3 - reserved,
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
MaxCLL 5 [55][BC] - - - - u * Maximum brightness of a single pixel (Maximum Content Light Level) in candelas per square meter (cd/m²).
MaxFALL 5 [55][BD] - - - - u * Maximum brightness of a single full frame (Maximum Frame-Average Light Level) in candelas per square meter (cd/m²).
MasteringMetadata 5 [55][D0] - - - - m * SMPTE 2086 mastering data.
PrimaryRChromaticityX 6 [55][D1] - - 0-1 - f * Red X chromaticity coordinate as defined by CIE 1931.
PrimaryRChromaticityY 6 [55][D2] - - 0-1 - f * Red Y chromaticity coordinate as defined by CIE 1931.
PrimaryGChromaticityX 6 [55][D3] - - 0-1 - f * Green X chromaticity coordinate as defined by CIE 1931.
PrimaryGChromaticityY 6 [55][D4] - - 0-1 - f * Green Y chromaticity coordinate as defined by CIE 1931.
PrimaryBChromaticityX 6 [55][D5] - - 0-1 - f * Blue X chromaticity coordinate as defined by CIE 1931.
PrimaryBChromaticityY 6 [55][D6] - - 0-1 - f * Blue Y chromaticity coordinate as defined by CIE 1931.
WhitePointChromaticityX 6 [55][D7] - - 0-1 - f * White X chromaticity coordinate as defined by CIE 1931.
WhitePointChromaticityY 6 [55][D8] - - 0-1 - f * White Y chromaticity coordinate as defined by CIE 1931.
LuminanceMax 6 [55][D9] - - >= 0x0p+0 - f * Maximum luminance. Represented in candelas per square meter (cd/m²).
LuminanceMin 6 [55][DA] - - >= 0x0p+0 - f * Minimum luminance. Represented in candelas per square meter (cd/m²).
Projection 4 [76][70] - - - - m * * Describes the video projection details. Used to render spherical and VR videos.
ProjectionType 5 [76][71] mand. - 0-3 0 u * * Describes the projection used for this video track.
0 - rectangular,
1 - equirectangular,
2 - cubemap,
3 - mesh
ProjectionPrivate 5 [76][72] - - - - b * * Private data that only applies to a specific projection.mantics ProjectionType equals 0 (Rectangular), then this element must not be present. ProjectionType equals 1 (Equirectangular), then this element must 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 element must 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 element must be present and contain the same binary data that would be stored inside an ISOBMFF Mesh Projection Box ('mshp').te: ISOBMFF box size and fourcc fields are not included in the binary data, but the FullBox version and flag fields are. This is to avoid redundant framing information while preserving versioning and semantics between the two container formats.
ProjectionPoseYaw 5 [76][73] mand. - - 0.0 f * * Specifies a yaw rotation to the projection.manticslue represents a clockwise rotation, in degrees, around the up vector. This rotation must be applied before any ProjectionPosePitch or ProjectionPoseRoll rotations. The value of this field should be in the -180 to 180 degree range.
ProjectionPosePitch 5 [76][74] mand. - - 0.0 f * * Specifies a pitch rotation to the projection.manticslue represents a counter-clockwise rotation, in degrees, around the right vector. This rotation must be applied after the ProjectionPoseYaw rotation and before the ProjectionPoseRoll rotation. The value of this field should be in the -90 to 90 degree range.
ProjectionPoseRoll 5 [76][75] mand. - - 0.0 f * * Specifies a roll rotation to the projection.manticslue represents a counter-clockwise rotation, in degrees, around the forward vector. This rotation must be applied after the ProjectionPoseYaw and ProjectionPosePitch rotations. The value of this field should be in the -180 to 180 degree range.
Audio 3 [E1] - - - - m * * * * * Audio settings.
SamplingFrequency 4 [B5] mand. - > 0x0p+0 8000.0 f * * * * * Sampling frequency in Hz.
OutputSamplingFrequency 4 [78][B5] - - > 0x0p+0 SamplingFrequency f * * * * * Real output sampling frequency in Hz (used for SBR techniques).
Channels 4 [9F] mand. - not 0 1 u * * * * * Numbers of channels in the track.
ChannelPositions 4 [7D][7B] - - - - b Table of horizontal angles for each successive channel, see appendix.
BitDepth 4 [62][64] - - not 0 - u * * * * * Bits per sample, mostly used for PCM.
TrackOperation 3 [E2] - - - - m * * Operation that needs to be applied on tracks to create this virtual track. For more details look at the Specification Notes on the subject.
TrackCombinePlanes 4 [E3] - - - - m * * Contains the list of all video plane tracks that need to be combined to create this 3D track
TrackPlane 5 [E4] mand. mult. - - m * * Contains a video plane track that need to be combined to create this 3D track
TrackPlaneUID 6 [E5] mand. - not 0 - u * * The trackUID number of the track representing the plane.
TrackPlaneType 6 [E6] mand. - - - u * * The kind of plane this track corresponds to.
0 - left eye,
1 - right eye,
2 - background
TrackJoinBlocks 4 [E9] - - - - m * * Contains the list of all tracks whose Blocks need to be combined to create this virtual track
TrackJoinUID 5 [ED] mand. mult. not 0 - u * * The trackUID number of a track whose blocks are used to create this virtual track.
TrickTrackUID 3 [C0] - - - - u DivX trick track extensions
TrickTrackSegmentUID 3 [C1] - - - - b DivX trick track extensions
TrickTrackFlag 3 [C6] - - - 0 u DivX trick track extensions
TrickMasterTrackUID 3 [C7] - - - - u DivX trick track extensions
TrickMasterTrackSegmentUID 3 [C4] - - - - b DivX trick track extensions
ContentEncodings 3 [6D][80] - - - - m * * * * * Settings for several content encoding mechanisms like compression or encryption.
ContentEncoding 4 [62][40] mand. mult. - - m * * * * * Settings for one content encoding like compression or encryption.
ContentEncodingOrder 5 [50][31] mand. - - 0 u * * * * * Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder Elements in the Segment.
ContentEncodingScope 5 [50][32] mand. - not 0 1 u * * * * * A bit field that describes which Elements have been modified in this way. Values (big endian) can be OR'ed.
1 - All frame contents, excluding lacing data,
2 - The track's private data,
4 - The next ContentEncoding (next `ContentEncodingOrder`. Either the data inside `ContentCompression` and/or `ContentEncryption`)
ContentEncodingType 5 [50][33] mand. - - 0 u * * * * * A value describing what kind of transformation is applied.
0 - Compression,
1 - Encryption
ContentCompression 5 [50][34] - - - - m * * * * Settings describing the compression used. This Element MUST be present if the value of ContentEncodingType is 0 and absent otherwise. Each block MUST be decompressable even if no previous block is available in order not to prevent seeking.
ContentCompAlgo 6 [42][54] mand. - - 0 u * * * * The compression algorithm used.
0 - zlib,
1 - bzlib,
2 - lzo1x,
3 - Header Stripping
ContentCompSettings 6 [42][55] - - - - b * * * * Settings that might be needed by the decompressor. For Header Stripping (`ContentCompAlgo`=3), the bytes that were removed from the beggining of each frames of the track.
ContentEncryption 5 [50][35] mand. - - - m * * * * * Settings describing the encryption used. This Element MUST be present if the value of `ContentEncodingType` is 1 (encryption) and MUST be ignored otherwise.
ContentEncAlgo 6 [47][E1] - - - 0 u * * * * * The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed.
0 - Not encrypted,
1 - DES - FIPS 46-3,
2 - Triple DES - RFC 1851,
3 - Twofish,
4 - Blowfish,
5 - AES - FIPS 187
ContentEncKeyID 6 [47][E2] - - - - b * * * * * For public key algorithms this is the ID of the public key the the data was encrypted with.
ContentEncAESSettings 6 [47][E7] - - - - m * * Settings describing the encryption algorithm used. If `ContentEncAlgo` != 5 this MUST be ignored.
AESSettingsCipherMode 7 [47][E8] mand. - - - u * * The AES cipher mode used in the encryption.
1 - AES-CTR / Counter, NIST SP 800-38A,
2 - AES-CBC / Cipher Block Chaining, NIST SP 800-38A
ContentSignature 6 [47][E3] - - - - b * * * * A cryptographic signature of the contents.
ContentSigKeyID 6 [47][E4] - - - - b * * * * This is the ID of the private key the data was signed with.
ContentSigAlgo 6 [47][E5] - - - 0 u * * * * The algorithm used for the signature.
0 - Not signed,
1 - RSA
ContentSigHashAlgo 6 [47][E6] - - - 0 u * * * * The hash algorithm used for the signature.
0 - Not signed,
1 - SHA1-160,
1 - MD5
Element Name L EBML ID Ma Mu Rng Default T 1 2 3 4 W Description
Cueing Data
Cues 1 [1C][53][BB][6B] - - - - m * * * * * A Top-Level Element to speed seeking access. All entries are local to the Segment. This Element SHOULD be mandatory for non "live" streams.
CuePoint 2 [BB] mand. mult. - - m * * * * * Contains all information relative to a seek point in the Segment.
CueTime 3 [B3] mand. - - - u * * * * * Absolute timestamp according to the Segment time base.
CueTrackPositions 3 [B7] mand. mult. - - m * * * * * Contain positions for different tracks corresponding to the timestamp.
CueTrack 4 [F7] mand. - not 0 - u * * * * * The track for which a position is given.
CueClusterPosition 4 [F1] mand. - - - u * * * * * The Segment Position of the Cluster containing the associated Block.
CueRelativePosition 4 [F0] - - - - u * The relative position inside the Cluster of the referenced SimpleBlock or BlockGroup with 0 being the first possible position for an Element inside that Cluster.
CueDuration 4 [B2] - - - - u * The duration of the block according to the Segment time base. If missing the track's DefaultDuration does not apply and no duration information is available in terms of the cues.
CueBlockNumber 4 [53][78] - - not 0 1 u * * * * * Number of the Block in the specified Cluster.
CueCodecState 4 [EA] - - - 0 u * * * The Segment Position of the Codec State corresponding to this Cue Element. 0 means that the data is taken from the initial Track Entry.
CueReference 4 [DB] - mult. - - m * * * The Clusters containing the referenced Blocks.
CueRefTime 5 [96] mand. - - - u * * * Timestamp of the referenced Block.
CueRefCluster 5 [97] mand. - - - u The Segment Position of the Cluster containing the referenced Block.
CueRefNumber 5 [53][5F] - - not 0 1 u Number of the referenced Block of Track X in the specified Cluster.
CueRefCodecState 5 [EB] - - - 0 u The Segment Position of the Codec State corresponding to this referenced Element. 0 means that the data is taken from the initial Track Entry.
Element Name L EBML ID Ma Mu Rng Default T 1 2 3 4 W Description
Attachment
Attachments 1 [19][41][A4][69] - - - - m * * * * Contain attached files.
AttachedFile 2 [61][A7] mand. mult. - - m * * * * An attached file.
FileDescription 3 [46][7E] - - - - 8 * * * * A human-friendly name for the attached file.
FileName 3 [46][6E] mand. - - - 8 * * * * Filename of the attached file.
FileMimeType 3 [46][60] mand. - - - s * * * * MIME type of the file.
FileData 3 [46][5C] mand. - - - b * * * * The data of the file.
FileUID 3 [46][AE] mand. - not 0 - u * * * * Unique ID representing the file, as random as possible.
FileReferral 3 [46][75] - - - - b A binary value that a track/codec can refer to when the attachment is needed.
FileUsedStartTime 3 [46][61] - - - - u DivX font extension
FileUsedEndTime 3 [46][62] - - - - u DivX font extension
Element Name L EBML ID Ma Mu Rng Default T 1 2 3 4 W Description
Chapters
Chapters 1 [10][43][A7][70] - - - - m * * * * * A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation.
EditionEntry 2 [45][B9] mand. mult. - - m * * * * * Contains all information about a Segment edition.
EditionUID 3 [45][BC] - - not 0 - u * * * * A unique ID to identify the edition. It's useful for tagging an edition.
EditionFlagHidden 3 [45][BD] mand. - 0-1 0 u * * * * If an edition is hidden (1), it SHOULD NOT be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)
EditionFlagDefault 3 [45][DB] mand. - 0-1 0 u * * * * If a flag is set (1) the edition SHOULD be used as the default one. (1 bit)
EditionFlagOrdered 3 [45][DD] - - 0-1 0 u * * * * Specify if the chapters can be defined multiple times and the order to play them is enforced. (1 bit)
ChapterAtom 3+ [B6] mand. mult. - - m * * * * * Contains the atom information to use as the chapter atom (apply to all tracks).
ChapterUID 4 [73][C4] mand. - not 0 - u * * * * * A unique ID to identify the Chapter.
ChapterStringUID 4 [56][54] - - - - 8 * * * A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage.
ChapterTimeStart 4 [91] mand. - - - u * * * * * Timestamp of the start of Chapter (not scaled).
ChapterTimeEnd 4 [92] - - - - u * * * * Timestamp of the end of Chapter (timestamp excluded, not scaled).
ChapterFlagHidden 4 [98] mand. - 0-1 0 u * * * * If a chapter is hidden (1), it SHOULD NOT be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)
ChapterFlagEnabled 4 [45][98] mand. - 0-1 1 u * * * * Specify whether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie SHOULD skip all the content between the TimeStart and TimeEnd of this chapter (see flag notes). (1 bit)
ChapterSegmentUID 4 [6E][67] - - >0 - b * * * * ChapterSegmentUID is mandatory if ChapterSegmentEditionUID is used.
ChapterSegmentEditionUID 4 [6E][BC] - - not 0 - u * * * * The EditionUID to play from the Segment linked in ChapterSegmentUID. If ChapterSegmentEditionUID is undeclared then no Edition of the linked Segment is used.
ChapterPhysicalEquiv 4 [63][C3] - - - - u * * * * Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values.
ChapterTrack 4 [8F] - - - - m * * * * List of tracks on which the chapter applies. If this Element is not present, all tracks apply
ChapterTrackNumber 5 [89] mand. mult. not 0 - u * * * * UID of the Track to apply this chapter too. In the absence of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absence of this Element indicates that the Chapter SHOULD be applied to any currently used Tracks.
ChapterDisplay 4 [80] - mult. - - m * * * * * Contains all possible strings to use for the chapter display.
ChapString 5 [85] mand. - - - 8 * * * * * Contains the string to use as the chapter atom.
ChapLanguage 5 [43][7C] mand. mult. - eng s * * * * * The languages corresponding to the string, in the bibliographic ISO-639-2 form. This Element MUST be ignored if the ChapLanguageIETF Element is used within the same ChapterDisplay Element.
ChapLanguageIETF 5 [43][7D] - - - - s * Specifies the language used in the ChapString according to BCP 47 and using the IANA Language Subtag Registry. If this Element is used, then any ChapLanguage Elements used in the same ChapterDisplay MUST be ignored.
ChapCountry 5 [43][7E] - mult. - - s * * * * The countries corresponding to the string, same 2 octets as in Internet domains. This Element MUST be ignored if the ChapLanguageIETF Element is used within the same ChapterDisplay Element.
ChapProcess 4 [69][44] - mult. - - m * * * * Contains all the commands associated to the Atom.
ChapProcessCodecID 5 [69][55] mand. - - 0 u * * * * Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later.
ChapProcessPrivate 5 [45][0D] - - - - b * * * * Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent.
ChapProcessCommand 5 [69][11] - mult. - - m * * * * Contains all the commands associated to the Atom.
ChapProcessTime 6 [69][22] mand. - - - u * * * * Defines when the process command SHOULD be handled
0 - during the whole chapter,
1 - before starting playback,
2 - after playback of the chapter
ChapProcessData 6 [69][33] mand. - - - b * * * * Contains the command information. The data SHOULD be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands.
Element Name L EBML ID Ma Mu Rng Default T 1 2 3 4 W Description
Tagging
Tags 1 [12][54][C3][67] - mult. - - m * * * * * Element containing metadata describing Tracks, Editions, Chapters, Attachments, or the Segment as a whole. A list of valid tags can be found here.
Tag 2 [73][73] mand. mult. - - m * * * * * A single metadata descriptor.
Targets 3 [63][C0] mand. - - - m * * * * * Specifies which other elements the metadata represented by the Tag applies to. If empty or not present, then the Tag describes everything in the Segment.
TargetTypeValue 4 [68][CA] - - - 50 u * * * * * A number to indicate the logical level of the target.
70 - COLLECTION,
60 - EDITION / ISSUE / VOLUME / OPUS / SEASON / SEQUEL,
50 - ALBUM / OPERA / CONCERT / MOVIE / EPISODE / CONCERT,
40 - PART / SESSION,
30 - TRACK / SONG / CHAPTER,
20 - SUBTRACK / PART / MOVEMENT / SCENE,
10 - SHOT
TargetType 4 [63][CA] - - - - s * * * * * An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType).
COLLECTION - COLLECTION,
EDITION - EDITION,
ISSUE - ISSUE,
VOLUME - VOLUME,
OPUS - OPUS,
SEASON - SEASON,
SEQUEL - SEQUEL,
ALBUM - ALBUM,
OPERA - OPERA,
CONCERT - CONCERT,
MOVIE - MOVIE,
EPISODE - EPISODE,
PART - PART,
SESSION - SESSION,
TRACK - TRACK,
SONG - SONG,
CHAPTER - CHAPTER,
SUBTRACK - SUBTRACK,
PART - PART,
MOVEMENT - MOVEMENT,
SCENE - SCENE,
SHOT - SHOT
TagTrackUID 4 [63][C5] - mult. - 0 u * * * * * A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment.
TagEditionUID 4 [63][C9] - mult. - 0 u * * * * A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment.
TagChapterUID 4 [63][C4] - mult. - 0 u * * * * A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment.
TagAttachmentUID 4 [63][C6] - mult. - 0 u * * * * A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment.
SimpleTag 3+ [67][C8] mand. mult. - - m * * * * * Contains general information about the target.
TagName 4 [45][A3] mand. - - - 8 * * * * * The name of the Tag that is going to be stored.
TagLanguage 4 [44][7A] mand. - - und s * * * * * Specifies the language of the tag specified, in the Matroska languages form. This Element MUST be ignored if the TagLanguageIETF Element is used within the same SimpleTag Element.
TagLanguageIETF 4 [44][7B] - - - - s * Specifies the language used in the TagString according to BCP 47 and using the IANA Language Subtag Registry. If this Element is used, then any TagLanguage Elements used in the same SimpleTag MUST be ignored.
TagDefault 4 [44][84] mand. - 0-1 1 u * * * * * A boolean value to indicate if this is the default/original language to use for the given tag.
TagString 4 [44][87] - - - - 8 * * * * * The value of the Tag.
TagBinary 4 [44][85] - - - - b * * * * * The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString.
Element Name L EBML ID Ma Mu Rng Default T 1 2 3 4 W Description

All top-levels elements (Segment and direct sub-elements) are coded on 4 octets, i.e. class D elements.

Appendix

Language Codes

Language codes can be either the 3 letters bibliographic ISO-639-2 form (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). Country codes are the same as used for internet domains.

Physical Types

Each level can have different meanings for audio and video. The ORIGINAL_MEDIUM tag can be used to specify a string for ChapterPhysicalEquiv = 60. Here is the list of possible levels for both audio and video :

ChapterPhysicalEquivAudioVideoComment
70SET / PACKAGESET / PACKAGEthe collection of different media
60CD / 12" / 10" / 7" / TAPE / MINIDISC / DATDVD / VHS / LASERDISCthe physical medium like a CD or a DVD
50SIDESIDEwhen the original medium (LP/DVD) has different sides
40-LAYERanother physical level on DVDs
30SESSIONSESSIONas found on CDs and DVDs
20TRACK-as found on audio CDs
10INDEX-the first logical level of the side/medium

Block Structure

Size = 1 + (1-8) + 4 + (4 + (4)) octets. So from 6 to 21 octets.

Bit 0 is the most significant bit.

Frames using references should be stored in "coding order". That means the references first and then the frames referencing them. A consequence is that timecodes may not be consecutive. But a frame with a past timecode must reference a frame already known, otherwise it's considered bad/void.

There can be many Blocks in a BlockGroup provided they all have the same timecode. It is used with different parts of a frame with different priorities.

Block Header
OffsetPlayerDescription
0x00+mustTrack Number (Track Entry). It is coded in EBML like form (1 octet if the value is < 0x80, 2 if < 0x4000, etc) (most significant bits set to increase the range).
0x01+mustTimecode (relative to Cluster timecode, signed int16)
0x03+-
Flags
BitPlayerDescription
0-3-Reserved, set to 0
4-Invisible, the codec should decode this frame but not display it
5-6mustLacing
  • 00 : no lacing
  • 01 : Xiph lacing
  • 11 : EBML lacing
  • 10 : fixed-size lacing
7-not used
Lace (when lacing bit is set)
0x00mustNumber of frames in the lace-1 (uint8)
0x01 / 0xXXmust*Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace).
(possibly) Laced Data
0x00mustConsecutive laced frames

Lacing

Lacing is a mechanism to save space when storing data. It is typically used for small blocks of data (refered to as frames in matroska). There are 3 types of lacing : the Xiph one inspired by what is found in the Ogg container, the EBML one which is the same with sizes coded differently and the fixed-size one where the size is not coded. As an example is better than words...

Let's say you want 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. As these data are small, you can store them in a lace to save space. They will then be solved in the same block as follows:

Xiph lacing

  • Block head (with lacing bits set to 01)
  • Lacing head: Number of frames in the lace -1, i.e. 2 (the 800 and 500 octets one)
  • Lacing sizes: only the 2 first ones will be coded, 800 gives 255;255;255;35, 500 gives 255;245. The size of the last frame is deduced from the total size of the Block.
  • Data in frame 1
  • Data in frame 2
  • Data in frame 3

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.

EBML lacing

In this case the size is not coded as blocks of 255 bytes, but as a difference with the previous size and this size is coded as in EBML. The first size in the lace is unsigned as in EBML. The others use a range shifting to get a sign on each value :

1xxx xxxx                                                                              - value -(2^6-1) to  2^6-1

                                                                                        (ie 0 to 2^7-2 minus 2^6-1, half of the range)

01xx xxxx  xxxx xxxx                                                                   - value -(2^13-1) to 2^13-1

001x xxxx  xxxx xxxx  xxxx xxxx                                                        - value -(2^20-1) to 2^20-1

0001 xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                             - value -(2^27-1) to 2^27-1

0000 1xxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                  - value -(2^34-1) to 2^34-1

0000 01xx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                       - value -(2^41-1) to 2^41-1

0000 001x  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx            - value -(2^48-1) to 2^48-1

  • Block head (with lacing bits set to 11)
  • Lacing head: Number of frames in the lace -1, i.e. 2 (the 800 and 400 octets one)
  • Lacing sizes: only the 2 first ones will be coded, 800 gives 0x320 0x4000 = 0x4320, 500 is coded as -300 : - 0x12C + 0x1FFF + 0x4000 = 0x5ED3. The size of the last frame is deduced from the total size of the Block.
  • Data in frame 1
  • Data in frame 2
  • Data in frame 3

Fixed-size lacing

In this case only the number of frames in the lace is saved, the size of each frame is deduced from the total size of the Block. For example, for 3 frames of 800 octets each :

  • Block head (with lacing bits set to 10)
  • Lacing head: Number of frames in the lace -1, i.e. 2
  • Data in frame 1
  • Data in frame 2
  • Data in frame 3

SimpleBlock Structure

The SimpleBlock is very inspired by the Block structure. The main differences are the added Keyframe flag and Discardable flag. Otherwise everything is the same.

Size = 1 + (1-8) + 4 + (4 + (4)) octets. So from 6 to 21 octets.

Bit 0 is the most significant bit.

Frames using references should be stored in "coding order". That means the references first and then the frames referencing them. A consequence is that timecodes may not be consecutive. But a frame with a past timecode must reference a frame already known, otherwise it's considered bad/void.

There can be many Blocks in a BlockGroup provided they all have the same timecode. It is used with different parts of a frame with different priorities.

SimpleBlock Header
OffsetPlayerDescription
0x00+mustTrack Number (Track Entry). It is coded in EBML like form (1 octet if the value is < 0x80, 2 if < 0x4000, etc) (most significant bits set to increase the range).
0x01+mustTimecode (relative to Cluster timecode, signed int16)
0x03+-
Flags
BitPlayerDescription
0-Keyframe, set when the Block contains only keyframes
1-3-Reserved, set to 0
4-Invisible, the codec should decode this frame but not display it
5-6mustLacing
  • 00 : no lacing
  • 01 : Xiph lacing
  • 11 : EBML lacing
  • 10 : fixed-size lacing
7-Discardable, the frames of the Block can be discarded during playing if needed
Lace (when lacing bit is set)
0x00mustNumber of frames in the lace-1 (uint8)
0x01 / 0xXXmust*Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace).
(possibly) Laced Data
0x00mustConsecutive laced frames

EncryptedBlock Structure

The EncryptedBlock is very inspired by the SimpleBlock structure. The main differences is that the raw data are Transformed. That means the data after the lacing definition (if present) have been processed before put into the Block. The laced sizes apply on the decoded (Inverse Transform) data. This size of the Transformed data may not match the size of the initial chunk of data.

The other difference is that the number of frames in the lace are not saved if "no lacing" is specified (bits 5 and 6 set to 0).

The Transformation is specified by a TransformID in the Block (must be the same for all frames within the EncryptedBlock).

Size = 1 + (1-8) + 4 + (4 + (4)) octets. So from 6 to 21 octets.

Bit 0 is the most significant bit.

Frames using references should be stored in "coding order". That means the references first and then the frames referencing them. A consequence is that timecodes may not be consecutive. But a frame with a past timecode must reference a frame already known, otherwise it's considered bad/void.

There can be many Blocks in a BlockGroup provided they all have the same timecode. It is used with different parts of a frame with different priorities.

EncryptedBlock Header
OffsetPlayerDescription
0x00+mustTrack Number (Track Entry). It is coded in EBML like form (1 octet if the value is < 0x80, 2 if < 0x4000, etc) (most significant bits set to increase the range).
0x01+mustTimecode (relative to Cluster timecode, signed int16)
0x03+-
Flags
BitPlayerDescription
0-Keyframe, set when the Block contains only keyframes
1-3-Reserved, set to 0
4-Invisible, the codec should decode this frame but not display it
5-6mustLacing
  • 00 : no lacing
  • 01 : Xiph lacing
  • 11 : EBML lacing
  • 10 : fixed-size lacing
7-Discardable, the frames of the Block can be discarded during playing if needed
Lace (when lacing bit is set)
0x00must*Number of frames in the lace-1 (uint8) *Only available if bit 5 or bit 6 of the EncryptedBlock flag is set to one.
0x01 / 0xXXmust*Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace).
(possibly) Laced Data
0x00mustTransformID (EBML coded integer value). Value 0 = Null Transform
0x01+mustConsecutive laced frames

Virtual Block

The data in matroska is stored in coding order. But that means if you seek to a particular point and a frame has been referenced far away, you won't know while playing and you might miss this frame (true for independent frames and overlapping of dependent frames). So the idea is to have a placeholder for the original frame in the timecode (display) order.

The structure is a scaled down version of the normal Block.

Virtual Block Header
OffsetPlayerDescription
0x00+mustTrack Number (Track Entry). It is coded in EBML like form (1 octet if the value is < 0x80, 2 if < 0x4000, etc) (most significant bits set to increase the range).
0x01+mustTimecode (relative to Cluster timecode, signed int16)
0x03+-
Flags
BitPlayerDescription
7-0-Reserved, set to 0