cellar | S. Lhomme |
Internet-Draft | |
Intended status: Standards Track | M. Bunkus |
Expires: May 27, 2017 | |
D. Rice | |
November 23, 2016 |
Matroska
draft-lhomme-cellar-matroska-01
This document defines the Matroska audiovisual container, including definitions of its structural Elements, as well as its terminology, vocabulary, and application.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on May 27, 2017.
Copyright (c) 2016 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 (http://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 Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Matroska aims to become THE standard of multimedia container formats. It was derived from a project called MCF, but differentiates from it significantly because it is based on EBML (Extensible Binary Meta Language), a binary derivative of XML. EBML enables significant advantages in terms of future format extensibility, without breaking file support in old parsers.
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 like:
Matroska is an open standards project. This means for personal use it is absolutely free to use and that the technical specifications describing the bitstream are open to everybody, even to companies that would like to support it in their products.
This document is a work-in-progress specification defining the Matroska file format as part of the IETF Cellar working group. But since it's quite complete it is used as a reference for the development of libmatroska. Legacy versions of the specification can be found here (PDF doc by Alexander Noé -- outdated).
For a simplified diagram of the layout of a Matroska file, see the Diagram page.
A more refined and detailed version of the EBML specifications is being worked on here.
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.
Matroska inherits security considerations from EBML. Other security considerations are to be determined.
To be determined.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
Matroska is a Document Type of EBML (Extensible Binary Meta Language). This specification is dependent on the EBML Specification. For an understanding of Matroska's EBML Schema, see in particular the sections of the EBML Specification covering EBML Element Types, EBML Schema, and EBML Structure.
As an EBML Document Type, Matroska adds the following constraints to the EBML specification.
All top-levels elements (Segment and direct sub-elements) are coded on 4 octets, i.e. class D elements.
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.
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 :
ChapterPhysicalEquiv | 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 like 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 audio CDs |
10 | INDEX | - | the first logical level of the side/medium |
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.
Offset | Player | Description |
---|---|---|
0x00+ | MUST | Track 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+ | MUST | Timecode (relative to Cluster timecode, signed int16) |
Offset | Bit | Player | Description |
---|---|---|---|
0x03+ | 0-3 | - | Reserved, set to 0 |
0x03+ | 4 | - | Invisible, the codec SHOULD decode this frame but not display it |
0x03+ | 5-6 | MUST | Lacing |
* 00 : no lacing | |||
* 01 : Xiph lacing | |||
* 11 : EBML lacing | |||
* 10 : fixed-size lacing | |||
0x03+ | 7 | - | not used |
When lacing bit is set.
Offset | Player | Description |
---|---|---|
0x00 | MUST | Number of frames in the lace-1 (uint8) |
0x01 / 0xXX | MUST* | 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). |
For (possibly) Laced Data
Offset | Player | Description |
---|---|---|
0x00 | MUST | Consecutive laced frames |
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:
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.
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 :
Bit Representation | 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 |
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 :
The SimpleBlock is very inspired by the [Block structure](({{site.baseurl}}/index.html#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.
Offset | Player | Description |
---|---|---|
0x00+ | MUST | Track 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+ | MUST | Timecode (relative to Cluster timecode, signed int16) |
Offset | Bit | Player | Description |
---|---|---|---|
0x03+ | 0 | - | Keyframe, set when the Block contains only keyframes |
0x03+ | 1-3 | - | Reserved, set to 0 |
0x03+ | 4 | - | Invisible, the codec SHOULD decode this frame but not display it |
0x03+ | 5-6 | MUST | Lacing |
* 00 : no lacing | |||
* 01 : Xiph lacing | |||
* 11 : EBML lacing | |||
* 10 : fixed-size lacing | |||
0x03+ | 7 | - | Discardable, the frames of the Block can be discarded during playing if needed |
When lacing bit is set.
Offset | Player | Description |
---|---|---|
0x00 | MUST | Number of frames in the lace-1 (uint8) |
0x01 / 0xXX | MUST* | 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). |
For (possibly) Laced Data
Offset | Player | Description |
---|---|---|
0x00 | MUST | Consecutive laced frames |
The EncryptedBlock is very inspired by the [SimpleBlock structure](({{site.baseurl}}/index.html#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 | | Offset | Player | Description | | 0x00+ | MUST | Track 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+ | MUST | Timecode (relative to Cluster timecode, signed int16) | | 0x03+ | - |
| Flags | | Bit | Player | Description | | 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-6 | MUST | Lacing
| | 7 | - | Discardable, the frames of the Block can be discarded during playing if needed |
| | Lace (when lacing bit is set) | | 0x00 | MUST* | 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 / 0xXX | MUST | 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 | | 0x00 | MUST | TransformID (EBML coded integer value). Value 0 = Null Transform | | 0x01+ | MUST | Consecutive laced frames |
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 | | Offset | Player | Description | | 0x00+ | MUST | Track 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+ | MUST | Timecode (relative to Cluster timecode, signed int16) | | 0x03+ | - |
| Flags | | Bit | Player | Description | | 7-0 | - | Reserved, set to 0 |
|
This specification includes an EBML Schema which defines the Elements and structure of Matroska as an EBML Document Type. The EBML Schema defines every valid Matroska element in a manner defined by the EBML specification.
In addition to the EBML Schema definition provided by the EBML Specification, Matroska adds the following additional attributes:
attribute name | required | definition |
---|---|---|
webm | No | A boolean to express if the Matroska Element is also supported within version 2 of the webm specification. Please consider the webm specification as the authoritative on webm. |
Here the definition of each Matroska Element is provided.
% concatenate with Matroska EBML Schema converted to markdown %
name: Segment
path: 1*1(\Segment)
id: 0x18538067
minOccurs: 1
type: master
minver: 1
documentation: The Root Element that contains all other Top-Level Elements (Elements defined only at Level 1). A Matroska file is composed of 1 Segment.
name: SeekHead
path: 0*2(\Segment\SeekHead)
id: 0x114D9B74
maxOccurs: 2
type: master
minver: 1
documentation: Contains the position of other Top-Level Elements.
name: Seek
path: 1*(\Segment\SeekHead\Seek)
id: 0x4DBB
minOccurs: 1
maxOccurs: unbounded
type: master
minver: 1
documentation: Contains a single seek entry to an EBML Element.
name: SeekID
path: 1*1(\Segment\SeekHead\Seek\SeekID)
id: 0x53AB
minOccurs: 1
type: binary
minver: 1
documentation: The binary ID corresponding to the Element name.
name: SeekPosition
path: 1*1(\Segment\SeekHead\Seek\SeekPosition)
id: 0x53AC
minOccurs: 1
type: uinteger
minver: 1
documentation: The position of the Element in the Segment in octets (0 = first level 1 Element).
name: Info
path: 1*(\Segment\Info)
id: 0x1549A966
minOccurs: 1
maxOccurs: unbounded
type: master
minver: 1
definition: Contains general information about the Segment.
name: SegmentUID
path: 0*1(\Segment\Info\SegmentUID)
id: 0x73A4
range: not 0
size: 16
type: binary
minver: 1
definition: A randomly generated unique ID to identify the Segment amongst many others (128 bits).
usage notes: If the Segment is a part of a Linked Segment then this Element is REQUIRED.
name: SegmentFilename
path: 0*1(\Segment\Info\SegmentFilename)
id: 0x7384
type: utf-8
minver: 1
definition: A filename corresponding to this Segment.
name: PrevUID
path: 0*1(\Segment\Info\PrevUID)
id: 0x3CB923
size: 16
type: binary
minver: 1
definition: A unique ID to identify the previous Segment of a Linked Segment (128 bits).
usage notes: 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.
name: PrevFilename
path: 0*1(\Segment\Info\PrevFilename)
id: 0x3C83AB
type: utf-8
minver: 1
definition: A filename corresponding to the file of the previous Linked Segment.
usage notes: Provision of the previous filename is for display convenience, but PrevUID SHOULD be considered authoritative for identifying the previous Segment in a Linked Segment.
name: NextUID
path: 0*1(\Segment\Info\NextUID)
id: 0x3EB923
size: 16
type: binary
minver: 1
definition: A unique ID to identify the next Segment of a Linked Segment (128 bits).
usage notes: 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.
name: NextFilename
path: 0*1(\Segment\Info\NextFilename)
id: 0x3E83BB
type: utf-8
minver: 1
definition: A filename corresponding to the file of the next Linked Segment.
usage notes: Provision of the next filename is for display convenience, but NextUID SHOULD be considered authoritative for identifying the Next Segment.
name: SegmentFamily
path: 0*(\Segment\Info\SegmentFamily)
id: 0x4444
maxOccurs: unbounded
size: 16
type: binary
minver: 1
definition: A randomly generated unique ID that all Segments of a Linked Segment MUST share (128 bits).
usage notes: If the Segment is a part of a Linked Segment that uses Soft Linking then this Element is REQUIRED.
name: ChapterTranslate
path: 0*(\Segment\Info\ChapterTranslate)
id: 0x6924
maxOccurs: unbounded
type: master
minver: 1
documentation: A tuple of corresponding ID used by chapter codecs to represent this Segment.
name: ChapterTranslateEditionUID
path: 0*(\Segment\Info\ChapterTranslate\ChapterTranslateEditionUID)
id: 0x69FC
maxOccurs: unbounded
type: uinteger
minver: 1
documentation: Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the Segment.
name: ChapterTranslateCodec
path: 1*1(\Segment\Info\ChapterTranslate\ChapterTranslateCodec)
id: 0x69BF
minOccurs: 1
type: uinteger
minver: 1
documentation: The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).
name: ChapterTranslateID
path: 1*1(\Segment\Info\ChapterTranslate\ChapterTranslateID)
id: 0x69A5
minOccurs: 1
type: binary
minver: 1
documentation: The binary value used to represent this Segment in the chapter codec data. The format depends on the ChapProcessCodecID used.
name: TimecodeScale
path: 1*1(\Segment\Info\TimecodeScale)
id: 0x2AD7B1
minOccurs: 1
default: 1000000
type: uinteger
minver: 1
documentation: Timestamp scale in nanoseconds (1.000.000 means all timestamps in the Segment are expressed in milliseconds).
name: Duration
path: 0*1(\Segment\Info\Duration)
id: 0x4489
range: > 0x0p+0
type: float
minver: 1
definition: Duration of the Segment in nanoseconds based on TimecodeScale.
name: DateUTC
path: 0*1(\Segment\Info\DateUTC)
id: 0x4461
type: date
minver: 1
documentation: The date and time that the Segment was created by the muxing application or library.
name: Title
path: 0*1(\Segment\Info\Title)
id: 0x7BA9
type: utf-8
minver: 1
documentation: General name of the Segment.
name: MuxingApp
path: 1*1(\Segment\Info\MuxingApp)
id: 0x4D80
minOccurs: 1
type: utf-8
minver: 1
definition: Muxing application or library (example: "libmatroska-0.4.3").
usage notes: Include the full name of the application or library followed by the version number.
name: WritingApp
path: 1*1(\Segment\Info\WritingApp)
id: 0x5741
minOccurs: 1
type: utf-8
minver: 1
definition: Writing application (example: "mkvmerge-0.3.3").
usage notes: Include the full name of the application followed by the version number.
name: Cluster
path: 0*(\Segment\Cluster)
id: 0x1F43B675
maxOccurs: unbounded
type: master
minver: 1
documentation: The Top-Level Element containing the (monolithic) Block structure.
name: Timecode
path: 1*1(\Segment\Cluster\Timecode)
id: 0xE7
minOccurs: 1
type: uinteger
minver: 1
documentation: Absolute timestamp of the cluster (based on TimecodeScale).
name: SilentTracks
path: 0*1(\Segment\Cluster\SilentTracks)
id: 0x5854
type: master
minver: 1
documentation: 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.
name: SilentTrackNumber
path: 0*(\Segment\Cluster\SilentTracks\SilentTrackNumber)
id: 0x58D7
maxOccurs: unbounded
type: uinteger
minver: 1
documentation: 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.
name: Position
path: 0*1(\Segment\Cluster\Position)
id: 0xA7
type: uinteger
minver: 1
documentation: The Position of the Cluster in the Segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams.
name: PrevSize
path: 0*1(\Segment\Cluster\PrevSize)
id: 0xAB
type: uinteger
minver: 1
documentation: Size of the previous Cluster, in octets. Can be useful for backward playing.
name: SimpleBlock
path: 0*(\Segment\Cluster\SimpleBlock)
id: 0xA3
maxOccurs: unbounded
type: binary
minver: 2
documentation: Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed. (see SimpleBlock Structure)
name: BlockGroup
path: 0*(\Segment\Cluster\BlockGroup)
id: 0xA0
maxOccurs: unbounded
type: master
minver: 1
documentation: Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock.
name: Block
path: 1*1(\Segment\Cluster\BlockGroup\Block)
id: 0xA1
minOccurs: 1
type: binary
minver: 1
documentation: Block containing the actual data to be rendered and a timestamp relative to the Cluster Timecode. (see Block Structure)
name: BlockVirtual
path: 0*1(\Segment\Cluster\BlockGroup\BlockVirtual)
id: 0xA2
type: binary
minver: 0
maxver: 0
documentation: 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)
name: BlockAdditions
path: 0*1(\Segment\Cluster\BlockGroup\BlockAdditions)
id: 0x75A1
type: master
minver: 1
documentation: 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.
name: BlockMore
path: 1*(\Segment\Cluster\BlockGroup\BlockAdditions\BlockMore)
id: 0xA6
minOccurs: 1
maxOccurs: unbounded
type: master
minver: 1
documentation: Contain the BlockAdditional and some parameters.
name: BlockAddID
path: 1*1(\Segment\Cluster\BlockGroup\BlockAdditions\BlockMore\BlockAddID)
id: 0xEE
minOccurs: 1
range: not 0
default: 1
type: uinteger
minver: 1
documentation: An ID to identify the BlockAdditional level.
name: BlockAdditional
path: 1*1(\Segment\Cluster\BlockGroup\BlockAdditions\BlockMore\BlockAdditional)
id: 0xA5
minOccurs: 1
type: binary
minver: 1
documentation: Interpreted by the codec as it wishes (using the BlockAddID).
name: BlockDuration
path: 0*1(\Segment\Cluster\BlockGroup\BlockDuration)
id: 0x9B
default: DefaultDuration
type: uinteger
minver: 1
documentation: The duration of the Block (based on TimecodeScale). 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. When set to 0 that means the frame is not a keyframe.
name: ReferencePriority
path: 1*1(\Segment\Cluster\BlockGroup\ReferencePriority)
id: 0xFA
minOccurs: 1
default: 0
type: uinteger
minver: 1
documentation: 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.
name: ReferenceBlock
path: 0*(\Segment\Cluster\BlockGroup\ReferenceBlock)
id: 0xFB
maxOccurs: unbounded
type: integer
minver: 1
documentation: Timestamp of another frame used as a reference (ie: B or P frame). The timestamp is relative to the block it's attached to.
name: ReferenceVirtual
path: 0*1(\Segment\Cluster\BlockGroup\ReferenceVirtual)
id: 0xFD
type: integer
minver: 0
maxver: 0
documentation: Relative position of the data that would otherwise be in position of the virtual block.
name: CodecState
path: 0*1(\Segment\Cluster\BlockGroup\CodecState)
id: 0xA4
type: binary
minver: 2
documentation: The new codec state to use. Data interpretation is private to the codec. This information SHOULD always be referenced by a seek entry.
name: DiscardPadding
path: 0*1(\Segment\Cluster\BlockGroup\DiscardPadding)
id: 0x75A2
type: integer
minver: 4
documentation: 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.
name: Slices
path: 0*1(\Segment\Cluster\BlockGroup\Slices)
id: 0x8E
type: master
minver: 1
documentation: Contains slices description.
name: TimeSlice
path: 0*(\Segment\Cluster\BlockGroup\Slices\TimeSlice)
id: 0xE8
maxOccurs: unbounded
type: master
minver: 1
documentation: Contains extra time information about the data contained in the Block. While there are a few files in the wild with this Element, it is no longer in use and has been deprecated. Being able to interpret this Element is not REQUIRED for playback.
name: LaceNumber
path: 0*1(\Segment\Cluster\BlockGroup\Slices\TimeSlice\LaceNumber)
id: 0xCC
default: 0
type: uinteger
minver: 1
documentation: The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this Element, it is no longer in use and has been deprecated. Being able to interpret this Element is not REQUIRED for playback.
name: FrameNumber
path: 0*1(\Segment\Cluster\BlockGroup\Slices\TimeSlice\FrameNumber)
id: 0xCD
default: 0
type: uinteger
minver: 0
maxver: 0
documentation: The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame).
name: BlockAdditionID
path: 0*1(\Segment\Cluster\BlockGroup\Slices\TimeSlice\BlockAdditionID)
id: 0xCB
default: 0
type: uinteger
minver: 0
maxver: 0
documentation: The ID of the BlockAdditional Element (0 is the main Block).
name: Delay
path: 0*1(\Segment\Cluster\BlockGroup\Slices\TimeSlice\Delay)
id: 0xCE
default: 0
type: uinteger
minver: 0
maxver: 0
documentation: The (scaled) delay to apply to the Element.
name: SliceDuration
path: 0*1(\Segment\Cluster\BlockGroup\Slices\TimeSlice\SliceDuration)
id: 0xCF
default: 0
type: uinteger
minver: 0
maxver: 0
documentation: The (scaled) duration to apply to the Element.
name: ReferenceFrame
path: 0*1(\Segment\Cluster\BlockGroup\ReferenceFrame)
id: 0xC8
type: master
minver: 0
maxver: 0
documentation: DivX trick track extenstions
name: ReferenceOffset
path: 1*1(\Segment\Cluster\BlockGroup\ReferenceFrame\ReferenceOffset)
id: 0xC9
minOccurs: 1
type: uinteger
minver: 0
maxver: 0
documentation: DivX trick track extenstions
name: ReferenceTimeCode
path: 1*1(\Segment\Cluster\BlockGroup\ReferenceFrame\ReferenceTimeCode)
id: 0xCA
minOccurs: 1
type: uinteger
minver: 0
maxver: 0
documentation: DivX trick track extenstions
name: EncryptedBlock
path: 0*(\Segment\Cluster\EncryptedBlock)
id: 0xAF
maxOccurs: unbounded
type: binary
minver: 0
maxver: 0
documentation: Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed). (see EncryptedBlock Structure)
name: Tracks
path: 0*(\Segment\Tracks)
id: 0x1654AE6B
maxOccurs: unbounded
type: master
minver: 1
documentation: A Top-Level Element of information with many tracks described.
name: TrackEntry
path: 1*(\Segment\Tracks\TrackEntry)
id: 0xAE
minOccurs: 1
maxOccurs: unbounded
type: master
minver: 1
documentation: Describes a track with all Elements.
name: TrackNumber
path: 1*1(\Segment\Tracks\TrackEntry\TrackNumber)
id: 0xD7
minOccurs: 1
range: not 0
type: uinteger
minver: 1
documentation: The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number).
name: TrackUID
path: 1*1(\Segment\Tracks\TrackEntry\TrackUID)
id: 0x73C5
minOccurs: 1
range: not 0
type: uinteger
minver: 1
documentation: 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.
name: TrackType
path: 1*1(\Segment\Tracks\TrackEntry\TrackType)
id: 0x83
minOccurs: 1
range: 1-254
type: uinteger
minver: 1
documentation: A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control).
name: FlagEnabled
path: 1*1(\Segment\Tracks\TrackEntry\FlagEnabled)
id: 0xB9
minOccurs: 1
range: 0-1
default: 1
type: uinteger
minver: 2
documentation: Set if the track is usable. (1 bit)
name: FlagDefault
path: 1*1(\Segment\Tracks\TrackEntry\FlagDefault)
id: 0x88
minOccurs: 1
range: 0-1
default: 1
type: uinteger
minver: 1
documentation: Set if that track (audio, video or subs) SHOULD be active if no language found matches the user preference. (1 bit)
name: FlagForced
path: 1*1(\Segment\Tracks\TrackEntry\FlagForced)
id: 0x55AA
minOccurs: 1
range: 0-1
default: 0
type: uinteger
minver: 1
documentation: 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)
name: FlagLacing
path: 1*1(\Segment\Tracks\TrackEntry\FlagLacing)
id: 0x9C
minOccurs: 1
range: 0-1
default: 1
type: uinteger
minver: 1
documentation: Set if the track MAY contain blocks using lacing. (1 bit)
name: MinCache
path: 1*1(\Segment\Tracks\TrackEntry\MinCache)
id: 0x6DE7
minOccurs: 1
default: 0
type: uinteger
minver: 1
documentation: 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.
name: MaxCache
path: 0*1(\Segment\Tracks\TrackEntry\MaxCache)
id: 0x6DF8
type: uinteger
minver: 1
documentation: The maximum cache size necessary to store referenced frames in and the current frame. 0 means no cache is needed.
name: DefaultDuration
path: 0*1(\Segment\Tracks\TrackEntry\DefaultDuration)
id: 0x23E383
range: not 0
type: uinteger
minver: 1
documentation: Number of nanoseconds (not scaled via TimecodeScale) per frame ('frame' in the Matroska sense -- one Element put into a (Simple)Block).
name: DefaultDecodedFieldDuration
path: 0*1(\Segment\Tracks\TrackEntry\DefaultDecodedFieldDuration)
id: 0x234E7A
range: not 0
type: uinteger
minver: 4
documentation: The period in nanoseconds (not scaled by TimcodeScale) between two successive fields at the output of the decoding process (see the notes)
name: TrackTimecodeScale
path: 1*1(\Segment\Tracks\TrackEntry\TrackTimecodeScale)
id: 0x23314F
minOccurs: 1
range: > 0x0p+0
default: 0x1p+0
type: float
minver: 0
maxver: 0
documentation: 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).
name: TrackOffset
path: 0*1(\Segment\Tracks\TrackEntry\TrackOffset)
id: 0x537F
default: 0
type: integer
minver: 0
maxver: 0
documentation: A value to add to the Block's Timestamp. This can be used to adjust the playback offset of a track.
name: MaxBlockAdditionID
path: 1*1(\Segment\Tracks\TrackEntry\MaxBlockAdditionID)
id: 0x55EE
minOccurs: 1
default: 0
type: uinteger
minver: 1
documentation: The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track.
name: Name
path: 0*1(\Segment\Tracks\TrackEntry\Name)
id: 0x536E
type: utf-8
minver: 1
documentation: A human-readable track name.
name: Language
path: 0*1(\Segment\Tracks\TrackEntry\Language)
id: 0x22B59C
default: eng
type: string
minver: 1
documentation: Specifies the language of the track in the Matroska languages form.
name: CodecID
path: 1*1(\Segment\Tracks\TrackEntry\CodecID)
id: 0x86
minOccurs: 1
type: string
minver: 1
documentation: An ID corresponding to the codec, see the codec page for more info.
name: CodecPrivate
path: 0*1(\Segment\Tracks\TrackEntry\CodecPrivate)
id: 0x63A2
type: binary
minver: 1
documentation: Private data only known to the codec.
name: CodecName
path: 0*1(\Segment\Tracks\TrackEntry\CodecName)
id: 0x258688
type: utf-8
minver: 1
documentation: A human-readable string specifying the codec.
name: AttachmentLink
path: 0*1(\Segment\Tracks\TrackEntry\AttachmentLink)
id: 0x7446
range: not 0
type: uinteger
minver: 1
documentation: The UID of an attachment that is used by this codec.
name: CodecSettings
path: 0*1(\Segment\Tracks\TrackEntry\CodecSettings)
id: 0x3A9697
type: utf-8
minver: 0
maxver: 0
documentation: A string describing the encoding setting used.
name: CodecInfoURL
path: 0*(\Segment\Tracks\TrackEntry\CodecInfoURL)
id: 0x3B4040
maxOccurs: unbounded
type: string
minver: 0
maxver: 0
documentation: A URL to find information about the codec used.
name: CodecDownloadURL
path: 0*(\Segment\Tracks\TrackEntry\CodecDownloadURL)
id: 0x26B240
maxOccurs: unbounded
type: string
minver: 0
maxver: 0
documentation: A URL to download about the codec used.
name: CodecDecodeAll
path: 1*1(\Segment\Tracks\TrackEntry\CodecDecodeAll)
id: 0xAA
minOccurs: 1
range: 0-1
default: 1
type: uinteger
minver: 2
documentation: The codec can decode potentially damaged data (1 bit).
name: TrackOverlay
path: 0*(\Segment\Tracks\TrackEntry\TrackOverlay)
id: 0x6FAB
maxOccurs: unbounded
type: uinteger
minver: 1
documentation: 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.
name: CodecDelay
path: 0*1(\Segment\Tracks\TrackEntry\CodecDelay)
id: 0x56AA
default: 0
type: uinteger
minver: 4
documentation: 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.
name: SeekPreRoll
path: 1*1(\Segment\Tracks\TrackEntry\SeekPreRoll)
id: 0x56BB
minOccurs: 1
default: 0
type: uinteger
minver: 4
documentation: After a discontinuity, SeekPreRoll is the duration in nanoseconds of the data the decoder MUST decode before the decoded data is valid.
name: TrackTranslate
path: 0*(\Segment\Tracks\TrackEntry\TrackTranslate)
id: 0x6624
maxOccurs: unbounded
type: master
minver: 1
documentation: The track identification for the given Chapter Codec.
name: TrackTranslateEditionUID
path: 0*(\Segment\Tracks\TrackEntry\TrackTranslate\TrackTranslateEditionUID)
id: 0x66FC
maxOccurs: unbounded
type: uinteger
minver: 1
documentation: Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the Segment.
name: TrackTranslateCodec
path: 1*1(\Segment\Tracks\TrackEntry\TrackTranslate\TrackTranslateCodec)
id: 0x66BF
minOccurs: 1
type: uinteger
minver: 1
documentation: The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).
name: TrackTranslateTrackID
path: 1*1(\Segment\Tracks\TrackEntry\TrackTranslate\TrackTranslateTrackID)
id: 0x66A5
minOccurs: 1
type: binary
minver: 1
documentation: The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used.
name: Video
path: 0*1(\Segment\Tracks\TrackEntry\Video)
id: 0xE0
type: master
minver: 1
documentation: Video settings.
name: FlagInterlaced
path: 1*1(\Segment\Tracks\TrackEntry\Video\FlagInterlaced)
id: 0x9A
minOccurs: 1
range: 0-2
default: 0
type: uinteger
minver: 2
documentation: A flag to declare is the video is known to be progressive or interlaced and if applicable to declare details about the interlacement. (0: undetermined, 1: interlaced, 2: progressive)
name: FieldOrder
path: 1*1(\Segment\Tracks\TrackEntry\Video\FieldOrder)
id: 0x9D
minOccurs: 1
range: 0-14
default: 2
type: uinteger
minver: 4
documentation: Declare the field ordering of the video. If FlagInterlaced is not set to 1, this Element MUST be ignored. (0: Progressive, 1: Interlaced with top field display first and top field stored first, 2: Undetermined field order, 6: Interlaced with bottom field displayed first and bottom field stored first, 9: Interlaced with bottom field displayed first and top field stored first, 14: Interlaced with top field displayed first and bottom field stored first)
name: StereoMode
path: 0*1(\Segment\Tracks\TrackEntry\Video\StereoMode)
id: 0x53B8
default: 0
type: uinteger
minver: 3
documentation: Stereo-3D video mode (0: mono, 1: side by side (left eye is first), 2: top-bottom (right eye is first), 3: top-bottom (left eye is first), 4: checkboard (right is first), 5: checkboard (left is first), 6: row interleaved (right is first), 7: row interleaved (left is first), 8: column interleaved (right is first), 9: column interleaved (left is first), 10: anaglyph (cyan/red), 11: side by side (right eye is 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)) . There are some more details on 3D support in the Specification Notes.
name: AlphaMode
path: 0*1(\Segment\Tracks\TrackEntry\Video\AlphaMode)
id: 0x53C0
default: 0
type: uinteger
minver: 3
documentation: Alpha Video Mode. Presence of this Element indicates that the BlockAdditional Element could contain Alpha data.
name: OldStereoMode
path: 0*1(\Segment\Tracks\TrackEntry\Video\OldStereoMode)
id: 0x53B9
type: uinteger
maxver: 0
documentation: DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska. (0: mono, 1: right eye, 2: left eye, 3: both eyes).
name: PixelWidth
path: 1*1(\Segment\Tracks\TrackEntry\Video\PixelWidth)
id: 0xB0
minOccurs: 1
range: not 0
type: uinteger
minver: 1
documentation: Width of the encoded video frames in pixels.
name: PixelHeight
path: 1*1(\Segment\Tracks\TrackEntry\Video\PixelHeight)
id: 0xBA
minOccurs: 1
range: not 0
type: uinteger
minver: 1
documentation: Height of the encoded video frames in pixels.
name: PixelCropBottom
path: 0*1(\Segment\Tracks\TrackEntry\Video\PixelCropBottom)
id: 0x54AA
default: 0
type: uinteger
minver: 1
documentation: The number of video pixels to remove at the bottom of the image (for HDTV content).
name: PixelCropTop
path: 0*1(\Segment\Tracks\TrackEntry\Video\PixelCropTop)
id: 0x54BB
default: 0
type: uinteger
minver: 1
documentation: The number of video pixels to remove at the top of the image.
name: PixelCropLeft
path: 0*1(\Segment\Tracks\TrackEntry\Video\PixelCropLeft)
id: 0x54CC
default: 0
type: uinteger
minver: 1
documentation: The number of video pixels to remove on the left of the image.
name: PixelCropRight
path: 0*1(\Segment\Tracks\TrackEntry\Video\PixelCropRight)
id: 0x54DD
default: 0
type: uinteger
minver: 1
documentation: The number of video pixels to remove on the right of the image.
name: DisplayWidth
path: 0*1(\Segment\Tracks\TrackEntry\Video\DisplayWidth)
id: 0x54B0
range: not 0
default: PixelWidth - PixelCropLeft - PixelCropRight
type: uinteger
minver: 1
documentation: 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.
name: DisplayHeight
path: 0*1(\Segment\Tracks\TrackEntry\Video\DisplayHeight)
id: 0x54BA
range: not 0
default: PixelHeight - PixelCropTop - PixelCropBottom
type: uinteger
minver: 1
documentation: 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.
name: DisplayUnit
path: 0*1(\Segment\Tracks\TrackEntry\Video\DisplayUnit)
id: 0x54B2
default: 0
type: uinteger
minver: 1
documentation: How DisplayWidth & DisplayHeight are interpreted (0: pixels, 1: centimeters, 2: inches, 3: Display Aspect Ratio, 4: Unknown).
name: AspectRatioType
path: 0*1(\Segment\Tracks\TrackEntry\Video\AspectRatioType)
id: 0x54B3
default: 0
type: uinteger
minver: 1
documentation: Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed).
name: ColourSpace
path: 0*1(\Segment\Tracks\TrackEntry\Video\ColourSpace)
id: 0x2EB524
size: 4
type: binary
minver: 1
documentation: Same value as in AVI (32 bits).
name: GammaValue
path: 0*1(\Segment\Tracks\TrackEntry\Video\GammaValue)
id: 0x2FB523
range: > 0x0p+0
type: float
minver: 0
maxver: 0
documentation: Gamma Value.
name: FrameRate
path: 0*1(\Segment\Tracks\TrackEntry\Video\FrameRate)
id: 0x2383E3
range: > 0x0p+0
type: float
minver: 0
maxver: 0
documentation: Number of frames per second. Informational only.
name: Colour
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour)
id: 0x55B0
type: master
minver: 4
documentation: Settings describing the colour format.
name: MatrixCoefficients
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\MatrixCoefficients)
id: 0x55B1
default: 2
type: uinteger
minver: 4
documentation: The Matrix Coefficients of the video used to derive luma and chroma values from reg, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2013/DCOR1. (0:GBR, 1: BT709, 2: Unspecified, 3: Reserved, 4: FCC, 5: BT470BG, 6: SMPTE 170M, 7: SMPTE 240M, 8: YCOCG, 9: BT2020 Non-constant Luminance, 10: BT2020 Constant Luminance)
name: BitsPerChannel
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\BitsPerChannel)
id: 0x55B2
default: 0
type: uinteger
minver: 4
documentation: Number of decoded bits per channel. A value of 0 indicates that the BitsPerChannel is unspecified.
name: ChromaSubsamplingHorz
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\ChromaSubsamplingHorz)
id: 0x55B3
type: uinteger
minver: 4
documentation: 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.
name: ChromaSubsamplingVert
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\ChromaSubsamplingVert)
id: 0x55B4
type: uinteger
minver: 4
documentation: 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.
name: CbSubsamplingHorz
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\CbSubsamplingHorz)
id: 0x55B5
type: uinteger
minver: 4
documentation: 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.
name: CbSubsamplingVert
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\CbSubsamplingVert)
id: 0x55B6
type: uinteger
minver: 4
documentation: The amount of pixels to remove in the Cb channel for every pixel not removed vertically. This is additive with ChromaSubsamplingVert.
name: ChromaSitingHorz
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\ChromaSitingHorz)
id: 0x55B7
default: 0
type: uinteger
minver: 4
documentation: How chroma is subsampled horizontally. (0: Unspecified, 1: Left Collocated, 2: Half)
name: ChromaSitingVert
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\ChromaSitingVert)
id: 0x55B8
default: 0
type: uinteger
minver: 4
documentation: How chroma is subsampled vertically. (0: Unspecified, 1: Top Collocated, 2: Half)
name: Range
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\Range)
id: 0x55B9
default: 0
type: uinteger
minver: 4
documentation: Clipping of the color ranges. (0: Unspecified, 1: Broadcast Range, 2: Full range (no clipping), 3: Defined by MatrixCoefficients/TransferCharacteristics)
name: TransferCharacteristics
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\TransferCharacteristics)
id: 0x55BA
default: 2
type: uinteger
minver: 4
documentation: The transfer characteristics of the video. For clarity, the value and meanings for TransferCharacteristics 1-15 are adopted from Table 3 of ISO/IEC 23001-8:2013/DCOR1. TransferCharacteristics 16-18 are proposed values. (0: Reserved, 1: ITU-R BT.709, 2: Unspecified, 3: Reserved, 4: Gamma 2.2 curve, 5: Gamma 2.8 curve, 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: SMPTE ST 2084, 17: SMPTE ST 428-1 18: ARIB STD-B67 (HLG))
name: Primaries
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\Primaries)
id: 0x55BB
default: 2
type: uinteger
minver: 4
documentation: The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23001-8:2013/DCOR1. (0: Reserved, 1: ITU-R BT.709, 2: Unspecified, 3: Reserved, 4: ITU-R BT.470M, 5: ITU-R BT.470BG, 6: SMPTE 170M, 7: SMPTE 240M, 8: FILM, 9: ITU-R BT.2020, 10: SMPTE ST 428-1, 22: JEDEC P22 phosphors)
name: MaxCLL
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\MaxCLL)
id: 0x55BC
type: uinteger
minver: 4
documentation: Maximum brightness of a single pixel (Maximum Content Light Level) in candelas per square meter (cd/m²).
name: MaxFALL
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\MaxFALL)
id: 0x55BD
type: uinteger
minver: 4
documentation: Maximum brightness of a single full frame (Maximum Frame-Average Light Level) in candelas per square meter (cd/m²).
name: MasteringMetadata
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\MasteringMetadata)
id: 0x55D0
type: master
minver: 4
documentation: SMPTE 2086 mastering data.
name: PrimaryRChromaticityX
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\PrimaryRChromaticityX\PrimaryRChromaticityX)
id: 0x55D1
range: 0-1
type: float
minver: 4
documentation: Red X chromaticity coordinate as defined by CIE 1931.
name: PrimaryRChromaticityY
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\PrimaryRChromaticityX\PrimaryRChromaticityY)
id: 0x55D2
range: 0-1
type: float
minver: 4
documentation: Red Y chromaticity coordinate as defined by CIE 1931.
name: PrimaryGChromaticityX
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\PrimaryRChromaticityX\PrimaryGChromaticityX)
id: 0x55D3
range: 0-1
type: float
minver: 4
documentation: Green X chromaticity coordinate as defined by CIE 1931.
name: PrimaryGChromaticityY
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\PrimaryRChromaticityX\PrimaryGChromaticityY)
id: 0x55D4
range: 0-1
type: float
minver: 4
documentation: Green Y chromaticity coordinate as defined by CIE 1931.
name: PrimaryBChromaticityX
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\PrimaryRChromaticityX\PrimaryBChromaticityX)
id: 0x55D5
range: 0-1
type: float
minver: 4
documentation: Blue X chromaticity coordinate as defined by CIE 1931.
name: PrimaryBChromaticityY
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\PrimaryRChromaticityX\PrimaryBChromaticityY)
id: 0x55D6
range: 0-1
type: float
minver: 4
documentation: Blue Y chromaticity coordinate as defined by CIE 1931.
name: WhitePointChromaticityX
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\PrimaryRChromaticityX\WhitePointChromaticityX)
id: 0x55D7
range: 0-1
type: float
minver: 4
documentation: White X chromaticity coordinate as defined by CIE 1931.
name: WhitePointChromaticityY
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\PrimaryRChromaticityX\WhitePointChromaticityY)
id: 0x55D8
range: 0-1
type: float
minver: 4
documentation: White Y chromaticity coordinate as defined by CIE 1931.
name: LuminanceMax
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\PrimaryRChromaticityX\LuminanceMax)
id: 0x55D9
range: 0-9999.99
type: float
minver: 4
documentation: Maximum luminance. Represented in candelas per square meter (cd/m²).
name: LuminanceMin
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\PrimaryRChromaticityX\LuminanceMin)
id: 0x55DA
range: 0-999.9999
type: float
minver: 4
documentation: Mininum luminance. Represented in candelas per square meter (cd/m²).
name: Audio
path: 0*1(\Segment\Tracks\TrackEntry\Audio)
id: 0xE1
type: master
minver: 1
documentation: Audio settings.
name: SamplingFrequency
path: 1*1(\Segment\Tracks\TrackEntry\Audio\SamplingFrequency)
id: 0xB5
minOccurs: 1
range: > 0x0p+0
default: 0x1.f4p+12
type: float
minver: 1
documentation: Sampling frequency in Hz.
name: OutputSamplingFrequency
path: 0*1(\Segment\Tracks\TrackEntry\Audio\OutputSamplingFrequency)
id: 0x78B5
range: > 0x0p+0
default: SamplingFrequency
type: float
minver: 1
documentation: Real output sampling frequency in Hz (used for SBR techniques).
name: Channels
path: 1*1(\Segment\Tracks\TrackEntry\Audio\Channels)
id: 0x9F
minOccurs: 1
range: not 0
default: 1
type: uinteger
minver: 1
documentation: Numbers of channels in the track.
name: ChannelPositions
path: 0*1(\Segment\Tracks\TrackEntry\Audio\ChannelPositions)
id: 0x7D7B
type: binary
minver: 0
maxver: 0
documentation: Table of horizontal angles for each successive channel, see appendix.
name: BitDepth
path: 0*1(\Segment\Tracks\TrackEntry\Audio\BitDepth)
id: 0x6264
range: not 0
type: uinteger
minver: 1
documentation: Bits per sample, mostly used for PCM.
name: TrackOperation
path: 0*1(\Segment\Tracks\TrackEntry\TrackOperation)
id: 0xE2
type: master
minver: 3
documentation: Operation that needs to be applied on tracks to create this virtual track. For more details look at the Specification Notes on the subject.
name: TrackCombinePlanes
path: 0*1(\Segment\Tracks\TrackEntry\TrackOperation\TrackCombinePlanes)
id: 0xE3
type: master
minver: 3
documentation: Contains the list of all video plane tracks that need to be combined to create this 3D track
name: TrackPlane
path: 1*(\Segment\Tracks\TrackEntry\TrackOperation\TrackCombinePlanes\TrackPlane)
id: 0xE4
minOccurs: 1
maxOccurs: unbounded
type: master
minver: 3
documentation: Contains a video plane track that need to be combined to create this 3D track
name: TrackPlaneUID
path: 1*1(\Segment\Tracks\TrackEntry\TrackOperation\TrackCombinePlanes\TrackPlane\TrackPlaneUID)
id: 0xE5
minOccurs: 1
range: not 0
type: uinteger
minver: 3
documentation: The trackUID number of the track representing the plane.
name: TrackPlaneType
path: 1*1(\Segment\Tracks\TrackEntry\TrackOperation\TrackCombinePlanes\TrackPlane\TrackPlaneType)
id: 0xE6
minOccurs: 1
type: uinteger
minver: 3
documentation: The kind of plane this track corresponds to (0: left eye, 1: right eye, 2: background).
name: TrackJoinBlocks
path: 0*1(\Segment\Tracks\TrackEntry\TrackOperation\TrackJoinBlocks)
id: 0xE9
type: master
minver: 3
documentation: Contains the list of all tracks whose Blocks need to be combined to create this virtual track
name: TrackJoinUID
path: 1*(\Segment\Tracks\TrackEntry\TrackOperation\TrackJoinBlocks\TrackJoinUID)
id: 0xED
minOccurs: 1
maxOccurs: unbounded
range: not 0
type: uinteger
minver: 3
documentation: The trackUID number of a track whose blocks are used to create this virtual track.
name: TrickTrackUID
path: 0*1(\Segment\Tracks\TrackEntry\TrickTrackUID)
id: 0xC0
type: uinteger
minver: 0
maxver: 0
documentation: DivX trick track extenstions
name: TrickTrackSegmentUID
path: 0*1(\Segment\Tracks\TrackEntry\TrickTrackSegmentUID)
id: 0xC1
size: 16
type: binary
minver: 0
maxver: 0
documentation: DivX trick track extenstions
name: TrickTrackFlag
path: 0*1(\Segment\Tracks\TrackEntry\TrickTrackFlag)
id: 0xC6
default: 0
type: uinteger
minver: 0
maxver: 0
documentation: DivX trick track extenstions
name: TrickMasterTrackUID
path: 0*1(\Segment\Tracks\TrackEntry\TrickMasterTrackUID)
id: 0xC7
type: uinteger
minver: 0
maxver: 0
documentation: DivX trick track extenstions
name: TrickMasterTrackSegmentUID
path: 0*1(\Segment\Tracks\TrackEntry\TrickMasterTrackSegmentUID)
id: 0xC4
size: 16
type: binary
minver: 0
maxver: 0
documentation: DivX trick track extenstions
name: ContentEncodings
path: 0*1(\Segment\Tracks\TrackEntry\ContentEncodings)
id: 0x6D80
type: master
minver: 1
documentation: Settings for several content encoding mechanisms like compression or encryption.
name: ContentEncoding
path: 1*(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding)
id: 0x6240
minOccurs: 1
maxOccurs: unbounded
type: master
minver: 1
documentation: Settings for one content encoding like compression or encryption.
name: ContentEncodingOrder
path: 1*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncodingOrder)
id: 0x5031
minOccurs: 1
default: 0
type: uinteger
minver: 1
documentation: 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.
name: ContentEncodingScope
path: 1*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncodingScope)
id: 0x5032
minOccurs: 1
range: not 0
default: 1
type: uinteger
minver: 1
documentation: A bit field that describes which Elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: 1 - all frame contents, 2 - the track's private data, 4 - the next ContentEncoding (next ContentEncodingOrder. Either the data inside ContentCompression and/or ContentEncryption)
name: ContentEncodingType
path: 1*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncodingType)
id: 0x5033
minOccurs: 1
default: 0
type: uinteger
minver: 1
documentation: A value describing what kind of transformation has been done. Possible values: 0 - compression, 1 - encryption
name: ContentCompression
path: 0*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentCompression)
id: 0x5034
type: master
minver: 1
documentation: 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.
name: ContentCompAlgo
path: 1*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentCompression\ContentCompAlgo)
id: 0x4254
minOccurs: 1
default: 0
type: uinteger
minver: 1
documentation: The compression algorithm used. Algorithms that have been specified so far are: 0 - zlib, 1 - bzlib, 2 - lzo1x 3 - Header Stripping
name: ContentCompSettings
path: 0*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentCompression\ContentCompSettings)
id: 0x4255
type: binary
minver: 1
documentation: 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.
name: ContentEncryption
path: 0*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncryption)
id: 0x5035
type: master
minver: 1
documentation: Settings describing the encryption used. This Element MUST be present if the value of ContentEncodingType is 1 and absent otherwise.
name: ContentEncAlgo
path: 0*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncryption\ContentEncAlgo)
id: 0x47E1
default: 0
type: uinteger
minver: 1
documentation: The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: 1 - DES, 2 - 3DES, 3 - Twofish, 4 - Blowfish, 5 - AES
name: ContentEncKeyID
path: 0*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncryption\ContentEncKeyID)
id: 0x47E2
type: binary
minver: 1
documentation: For public key algorithms this is the ID of the public key the the data was encrypted with.
name: ContentSignature
path: 0*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncryption\ContentSignature)
id: 0x47E3
type: binary
minver: 1
documentation: A cryptographic signature of the contents.
name: ContentSigKeyID
path: 0*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncryption\ContentSigKeyID)
id: 0x47E4
type: binary
minver: 1
documentation: This is the ID of the private key the data was signed with.
name: ContentSigAlgo
path: 0*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncryption\ContentSigAlgo)
id: 0x47E5
default: 0
type: uinteger
minver: 1
documentation: The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: 1 - RSA
name: ContentSigHashAlgo
path: 0*1(\Segment\Tracks\TrackEntry\ContentEncodings\ContentEncoding\ContentEncryption\ContentSigHashAlgo)
id: 0x47E6
default: 0
type: uinteger
minver: 1
documentation: The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: 1 - SHA1-160 2 - MD5
name: Cues
path: 0*1(\Segment\Cues)
id: 0x1C53BB6B
type: master
minver: 1
documentation: A Top-Level Element to speed seeking access. All entries are local to the Segment. This Element SHOULD be mandatory for non "live" streams.
name: CuePoint
path: 1*(\Segment\Cues\CuePoint)
id: 0xBB
minOccurs: 1
maxOccurs: unbounded
type: master
minver: 1
documentation: Contains all information relative to a seek point in the Segment.
name: CueTime
path: 1*1(\Segment\Cues\CuePoint\CueTime)
id: 0xB3
minOccurs: 1
type: uinteger
minver: 1
documentation: Absolute timestamp according to the Segment time base.
name: CueTrackPositions
path: 1*(\Segment\Cues\CuePoint\CueTrackPositions)
id: 0xB7
minOccurs: 1
maxOccurs: unbounded
type: master
minver: 1
documentation: Contain positions for different tracks corresponding to the timestamp.
name: CueTrack
path: 1*1(\Segment\Cues\CuePoint\CueTrackPositions\CueTrack)
id: 0xF7
minOccurs: 1
range: not 0
type: uinteger
minver: 1
documentation: The track for which a position is given.
name: CueClusterPosition
path: 1*1(\Segment\Cues\CuePoint\CueTrackPositions\CueClusterPosition)
id: 0xF1
minOccurs: 1
type: uinteger
minver: 1
documentation: The position of the Cluster containing the associated Block.
name: CueRelativePosition
path: 0*1(\Segment\Cues\CuePoint\CueTrackPositions\CueRelativePosition)
id: 0xF0
type: uinteger
minver: 4
documentation: The relative position of the referenced block inside the cluster with 0 being the first possible position for an Element inside that cluster.
name: CueDuration
path: 0*1(\Segment\Cues\CuePoint\CueTrackPositions\CueDuration)
id: 0xB2
type: uinteger
minver: 4
documentation: 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.
name: CueBlockNumber
path: 0*1(\Segment\Cues\CuePoint\CueTrackPositions\CueBlockNumber)
id: 0x5378
range: not 0
default: 1
type: uinteger
minver: 1
documentation: Number of the Block in the specified Cluster.
name: CueCodecState
path: 0*1(\Segment\Cues\CuePoint\CueTrackPositions\CueCodecState)
id: 0xEA
default: 0
type: uinteger
minver: 2
documentation: The position of the Codec State corresponding to this Cue Element. 0 means that the data is taken from the initial Track Entry.
name: CueReference
path: 0*(\Segment\Cues\CuePoint\CueTrackPositions\CueReference)
id: 0xDB
maxOccurs: unbounded
type: master
minver: 2
documentation: The Clusters containing the referenced Blocks.
name: CueRefTime
path: 1*1(\Segment\Cues\CuePoint\CueTrackPositions\CueReference\CueRefTime)
id: 0x96
minOccurs: 1
type: uinteger
minver: 2
documentation: Timestamp of the referenced Block.
name: CueRefCluster
path: 1*1(\Segment\Cues\CuePoint\CueTrackPositions\CueReference\CueRefCluster)
id: 0x97
minOccurs: 1
type: uinteger
minver: 0
maxver: 0
documentation: The Position of the Cluster containing the referenced Block.
name: CueRefNumber
path: 0*1(\Segment\Cues\CuePoint\CueTrackPositions\CueReference\CueRefNumber)
id: 0x535F
range: not 0
default: 1
type: uinteger
minver: 0
maxver: 0
documentation: Number of the referenced Block of Track X in the specified Cluster.
name: CueRefCodecState
path: 0*1(\Segment\Cues\CuePoint\CueTrackPositions\CueReference\CueRefCodecState)
id: 0xEB
default: 0
type: uinteger
minver: 0
maxver: 0
documentation: The position of the Codec State corresponding to this referenced Element. 0 means that the data is taken from the initial Track Entry.
name: Attachments
path: 0*1(\Segment\Attachments)
id: 0x1941A469
type: master
minver: 1
documentation: Contain attached files.
name: AttachedFile
path: 1*(\Segment\Attachments\AttachedFile)
id: 0x61A7
minOccurs: 1
maxOccurs: unbounded
type: master
minver: 1
documentation: An attached file.
name: FileDescription
path: 0*1(\Segment\Attachments\AttachedFile\FileDescription)
id: 0x467E
type: utf-8
minver: 1
documentation: A human-friendly name for the attached file.
name: FileName
path: 1*1(\Segment\Attachments\AttachedFile\FileName)
id: 0x466E
minOccurs: 1
type: utf-8
minver: 1
documentation: Filename of the attached file.
name: FileMimeType
path: 1*1(\Segment\Attachments\AttachedFile\FileMimeType)
id: 0x4660
minOccurs: 1
type: string
minver: 1
documentation: MIME type of the file.
name: FileData
path: 1*1(\Segment\Attachments\AttachedFile\FileData)
id: 0x465C
minOccurs: 1
type: binary
minver: 1
documentation: The data of the file.
name: FileUID
path: 1*1(\Segment\Attachments\AttachedFile\FileUID)
id: 0x46AE
minOccurs: 1
range: not 0
type: uinteger
minver: 1
documentation: Unique ID representing the file, as random as possible.
name: FileReferral
path: 0*1(\Segment\Attachments\AttachedFile\FileReferral)
id: 0x4675
type: binary
minver: 0
maxver: 0
documentation: A binary value that a track/codec can refer to when the attachment is needed.
name: FileUsedStartTime
path: 0*1(\Segment\Attachments\AttachedFile\FileUsedStartTime)
id: 0x4661
type: uinteger
minver: 0
maxver: 0
documentation: DivX font extension
name: FileUsedEndTime
path: 0*1(\Segment\Attachments\AttachedFile\FileUsedEndTime)
id: 0x4662
type: uinteger
minver: 0
maxver: 0
documentation: DivX font extension
name: Chapters
path: 0*1(\Segment\Chapters)
id: 0x1043A770
type: master
minver: 1
documentation: A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation.
name: EditionEntry
path: 1*(\Segment\Chapters\EditionEntry)
id: 0x45B9
minOccurs: 1
maxOccurs: unbounded
type: master
minver: 1
documentation: Contains all information about a Segment edition.
name: EditionUID
path: 0*1(\Segment\Chapters\EditionEntry\EditionUID)
id: 0x45BC
range: not 0
type: uinteger
minver: 1
documentation: A unique ID to identify the edition. It's useful for tagging an edition.
name: EditionFlagHidden
path: 1*1(\Segment\Chapters\EditionEntry\EditionFlagHidden)
id: 0x45BD
minOccurs: 1
range: 0-1
default: 0
type: uinteger
minver: 1
documentation: 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)
name: EditionFlagDefault
path: 1*1(\Segment\Chapters\EditionEntry\EditionFlagDefault)
id: 0x45DB
minOccurs: 1
range: 0-1
default: 0
type: uinteger
minver: 1
documentation: If a flag is set (1) the edition SHOULD be used as the default one. (1 bit)
name: EditionFlagOrdered
path: 0*1(\Segment\Chapters\EditionEntry\EditionFlagOrdered)
id: 0x45DD
range: 0-1
default: 0
type: uinteger
minver: 1
documentation: Specify if the chapters can be defined multiple times and the order to play them is enforced. (1 bit)
name: ChapterAtom
path: 1*(\Segment\Chapters\EditionEntry(1*(\ChapterAtom)))
id: 0xB6
minOccurs: 1
maxOccurs: unbounded
type: master
recursive: 1
minver: 1
documentation: Contains the atom information to use as the chapter atom (apply to all tracks).
name: ChapterUID
path: 1*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterUID)
id: 0x73C4
minOccurs: 1
range: not 0
type: uinteger
minver: 1
documentation: A unique ID to identify the Chapter.
name: ChapterStringUID
path: 0*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterStringUID)
id: 0x5654
type: utf-8
minver: 3
documentation: A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage.
name: ChapterTimeStart
path: 1*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterTimeStart)
id: 0x91
minOccurs: 1
type: uinteger
minver: 1
documentation: Timestamp of the start of Chapter (not scaled).
name: ChapterTimeEnd
path: 0*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterTimeEnd)
id: 0x92
type: uinteger
minver: 1
documentation: Timestamp of the end of Chapter (timestamp excluded, not scaled).
name: ChapterFlagHidden
path: 1*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterFlagHidden)
id: 0x98
minOccurs: 1
range: 0-1
default: 0
type: uinteger
minver: 1
documentation: 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)
name: ChapterFlagEnabled
path: 1*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterFlagEnabled)
id: 0x4598
minOccurs: 1
range: 0-1
default: 1
type: uinteger
minver: 1
documentation: Specify wether 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)
name: ChapterSegmentUID
path: 0*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterSegmentUID)
id: 0x6E67
range: >0
size: 16
type: binary
minver: 1
documentation: The SegmentUID of another Segment to play during this chapter.
usage notes: ChapterSegmentUID is mandatory if ChapterSegmentEditionUID is used.
name: ChapterSegmentEditionUID
path: 0*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterSegmentEditionUID)
id: 0x6EBC
range: not 0
type: uinteger
minver: 1
documentation: The EditionUID to play from the Segment linked in ChapterSegmentUID. If ChapterSegmentEditionUID is undeclared then no Edition of the linked Segment is used.
name: ChapterPhysicalEquiv
path: 0*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterPhysicalEquiv)
id: 0x63C3
type: uinteger
minver: 1
documentation: Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values.
name: ChapterTrack
path: 0*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterTrack)
id: 0x8F
type: master
minver: 1
documentation: List of tracks on which the chapter applies. If this Element is not present, all tracks apply
name: ChapterTrackNumber
path: 1*(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterTrack\ChapterTrackNumber)
id: 0x89
minOccurs: 1
maxOccurs: unbounded
range: not 0
type: uinteger
minver: 1
documentation: 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.
name: ChapterDisplay
path: 0*(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterDisplay)
id: 0x80
maxOccurs: unbounded
type: master
minver: 1
documentation: Contains all possible strings to use for the chapter display.
name: ChapString
path: 1*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterDisplay\ChapString)
id: 0x85
minOccurs: 1
type: utf-8
minver: 1
documentation: Contains the string to use as the chapter atom.
name: ChapLanguage
path: 1*(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterDisplay\ChapLanguage)
id: 0x437C
minOccurs: 1
maxOccurs: unbounded
default: eng
type: string
minver: 1
documentation: The languages corresponding to the string, in the bibliographic ISO-639-2 form.
name: ChapCountry
path: 0*(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterDisplay\ChapCountry)
id: 0x437E
maxOccurs: unbounded
type: string
minver: 1
documentation: The countries corresponding to the string, same 2 octets as in Internet domains.
name: ChapProcess
path: 0*(\Segment\Chapters\EditionEntry\ChapterAtom\ChapProcess)
id: 0x6944
maxOccurs: unbounded
type: master
minver: 1
documentation: Contains all the commands associated to the Atom.
name: ChapProcessCodecID
path: 1*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapProcess\ChapProcessCodecID)
id: 0x6955
minOccurs: 1
default: 0
type: uinteger
minver: 1
documentation: 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.
name: ChapProcessPrivate
path: 0*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapProcess\ChapProcessPrivate)
id: 0x450D
type: binary
minver: 1
documentation: Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent.
name: ChapProcessCommand
path: 0*(\Segment\Chapters\EditionEntry\ChapterAtom\ChapProcess\ChapProcessCommand)
id: 0x6911
maxOccurs: unbounded
type: master
minver: 1
documentation: Contains all the commands associated to the Atom.
name: ChapProcessTime
path: 1*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapProcess\ChapProcessCommand\ChapProcessTime)
id: 0x6922
minOccurs: 1
type: uinteger
minver: 1
documentation: Defines when the process command SHOULD be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter).
name: ChapProcessData
path: 1*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapProcess\ChapProcessCommand\ChapProcessData)
id: 0x6933
minOccurs: 1
type: binary
minver: 1
documentation: 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.
name: Tags
path: 0*(\Segment\Tags)
id: 0x1254C367
maxOccurs: unbounded
type: master
minver: 1
documentation: Element containing Elements specific to Tracks/Chapters. A list of valid tags can be found here.
name: Tag
path: 1*(\Segment\Tags\Tag)
id: 0x7373
minOccurs: 1
maxOccurs: unbounded
type: master
minver: 1
documentation: Element containing Elements specific to Tracks/Chapters.
name: Targets
path: 1*1(\Segment\Tags\Tag\Targets)
id: 0x63C0
minOccurs: 1
type: master
minver: 1
documentation: Contain all UIDs where the specified meta data apply. It is empty to describe everything in the Segment.
name: TargetTypeValue
path: 0*1(\Segment\Tags\Tag\Targets\TargetTypeValue)
id: 0x68CA
default: 50
type: uinteger
minver: 1
documentation: A number to indicate the logical level of the target (see TargetType).
name: TargetType
path: 0*1(\Segment\Tags\Tag\Targets\TargetType)
id: 0x63CA
type: string
minver: 1
documentation: An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType).
name: TagTrackUID
path: 0*(\Segment\Tags\Tag\Targets\TagTrackUID)
id: 0x63C5
maxOccurs: unbounded
default: 0
type: uinteger
minver: 1
documentation: 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.
name: TagEditionUID
path: 0*(\Segment\Tags\Tag\Targets\TagEditionUID)
id: 0x63C9
maxOccurs: unbounded
default: 0
type: uinteger
minver: 1
documentation: 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.
name: TagChapterUID
path: 0*(\Segment\Tags\Tag\Targets\TagChapterUID)
id: 0x63C4
maxOccurs: unbounded
default: 0
type: uinteger
minver: 1
documentation: 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.
name: TagAttachmentUID
path: 0*(\Segment\Tags\Tag\Targets\TagAttachmentUID)
id: 0x63C6
maxOccurs: unbounded
default: 0
type: uinteger
minver: 1
documentation: 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.
name: SimpleTag
path: 1*(\Segment\Tags\Tag(1*(\SimpleTag)))
id: 0x67C8
minOccurs: 1
maxOccurs: unbounded
type: master
recursive: 1
minver: 1
documentation: Contains general information about the target.
name: TagName
path: 1*1(\Segment\Tags\Tag\SimpleTag\TagName)
id: 0x45A3
minOccurs: 1
type: utf-8
minver: 1
documentation: The name of the Tag that is going to be stored.
name: TagLanguage
path: 1*1(\Segment\Tags\Tag\SimpleTag\TagLanguage)
id: 0x447A
minOccurs: 1
default: und
type: string
minver: 1
documentation: Specifies the language of the tag specified, in the Matroska languages form.
name: TagDefault
path: 1*1(\Segment\Tags\Tag\SimpleTag\TagDefault)
id: 0x4484
minOccurs: 1
range: 0-1
default: 1
type: uinteger
minver: 1
documentation: Indication to know if this is the default/original language to use for the given tag. (1 bit)
name: TagString
path: 0*1(\Segment\Tags\Tag\SimpleTag\TagString)
id: 0x4487
type: utf-8
minver: 1
documentation: The value of the Tag.
name: TagBinary
path: 0*1(\Segment\Tags\Tag\SimpleTag\TagBinary)
id: 0x4485
type: binary
minver: 1
documentation: The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString.
If you intend to implement a Matroska player, make sure you can handle all the files in our test suite, or at least the features presented there, not necessarily the same codecs.
An EBML file always starts with 0x1A. The 0x1A makes the DOS command "type" ends display. That way you can include ASCII text before the EBML data and it can be displayed. The EBML parser is safe from false-alarm with these ASCII only codes.
Next the EBML header is stored. This allows the the parser to know what type of EBML file it is parsing.
The Block's timecode is signed integer that represents the Raw Timecode relative to the Cluster's Timecode, multiplied by the TimecodeScale (see the TimecodeScale notes).
The Block's timecode is represented by a 16bit signed integer (sint16). This means that the Block's timecode has a range of -32768 to +32767 units. When using the default value of TimecodeScale, each integer represents 1ms. So, the maximum time span of Blocks in a Cluster using the default TimecodeScale of 1ms is 65536ms.
If a Cluster's Timecode is set to zero, it is possible to have Blocks with a negative Raw Timecode. Blocks with a negative Raw Timecode are not valid.
The DefaultDecodedFieldDuration Element can signal to the displaying application how often fields of a video sequence will be available for displaying. It can be used for both interlaced and progressive content.
If the video sequence is signaled as interlaced, then the period between two successive fields at the output of the decoding process equals DefaultDecodedFieldDuration.
For video sequences signaled as progressive it is twice the value of DefaultDecodedFieldDuration.
These values are valid at the end of the decoding process before post-processing like deinterlacing or inverse telecine is applied.
Examples:
The default value of an Element is assumed when not present in the data stream. It is assumed only in the scope of its Parent Element (for example Language in the scope of the Track element). If the Parent Element is not present or assumed, then the Element cannot be assumed.
Digital Rights Management. See Encryption.
Encryption in Matroska is designed in a very generic style that allows people to implement whatever form of encryption is best for them. It is easily possible to use the encryption framework in Matroska as a type of DRM.
Because the encryption occurs within the Block, it is possible to manipulate encrypted streams without decrypting them. The streams could potentially be copied, deleted, cut, appended, or any number of other possible editing techniques without ever decrypting them. This means that the data is more useful, without having to expose it, or go through the intensive process of decrypting.
Encryption can also be layered within Matroska. This means that two completely different types of encryption can be used, requiring two seperate keys to be able to decrypt a stream.
Encryption information is stored in the ContentEncodings Master-element under the ContentEncryption Element.
Thanks to the PixelCropXXX elements, it's possible to crop the image before being resized. That means the image size follows this path:
PixelXXX (size of the coded image) -> PixelCropXXX (size of the image to keep) -> DisplayXXX (resized cropped image)
The EBML Header each Matroska file starts with contains two version number fields that inform a reading application about what to expect. These are DocTypeVersion and DocTypeReadVersion.
DocTypeVersion MUST contain the highest Matroska version number of any Element present in the Matroska file. For example, a file using the SimpleBlock Element MUST have a DocTypeVersion of at least 2 while a file containing CueRelativePosition Elements MUST have a DocTypeVersion of at least 4.
The DocTypeReadVersion MUST contain the minimum version number a reading application MUST at least suppost properly in order to play the file back (optionally with a reduced feature set). For example, if a file contains only Elements of version 2 or lower except for CueRelativePosition (which is a version 4 Matroska Element) then DocTypeReadVersion SHOULD still be set to 2 and not 4 because evaluating CueRelativePosition is not REQUIRED for standard playback -- it only makes seeking more precise if used.
DocTypeVersion MUST always be equal to or greater than DocTypeReadVersion.
A reading application supporting Matroska version V MUST NOT refuse to read an application with DocReadTypeVersion equal to or lower than V even if DocTypeVersion is greater than V. See also the note about Unknown Elements.
There is no IETF endorsed MIME type for Matroska files. But you can use the ones we have defined on our web server:
An Octet refers to a byte made of 8 bits.
Overlay tracks SHOULD be rendered in the same 'channel' as the track it's linked to. When content is found in such a track it is played on the rendering channel instead of the original track.
The position in some Elements refers to the position, in octets, from the beginning of an Element. The reference is the beginning of the first Segment (= its position + the size of its ID and size fields). 0 = first possible position of a level 1 Element in the Segment. When data is spanned over mutiple Segments within a Section 21 (in the same file or in different files), the position represents the accumulated offset of each Segment. For example to reference a position in the third Segment, the position will be: the first segment total size + second segment total size + offset of the Element in the third segment.
The exact time of an object represented in nanoseconds. To find out a Block's Raw Timecode, you need the Block's timecode, the Cluster's Timecode, and the TimecodeScale. For calculation, please see the see the TimecodeScale notes.
Matroska provides several methods to link two or many Segments together to create a Linked Segment. A Linked Segment is a set of multiple Segments related together into a single presentation by using Hard Linking, Soft Linking, or Medium Linking. All Segments within a Linked Segment MUST utilize the same track numbers and timescale. All Segments within a Linked Segment MUST be stored within the same directory. All Segments within a Linked Segment MUST store a SegmentUID.
Hard Linking (also called splitting) is the process of creating a Linked Segment by relating multiple Segments using the PrevUID and NextUID Elements. Within a Linked Segment the timestamps of each Segment MUST follow consecutively in linking order. With Hard Linking, the chapters of any Segment within the Linked Segment MUST only reference the current Segment. With Hard Linking, the NextUID and PrevUID MUST reference the respective SegmentUID values of the next and previous Segments. The first Segment of a Linked Segment MUST have a NextUID Element and MUST NOT have a PrevUID Element. The last Segment of a Linked Segment MUST have a PrevUID Element and MUST NOT have a NextUID Element. The middle Segments of a Linked Segment MUST have both a NextUID Element and a PrevUID Element.
As an example four Segments MAY be Hard Linked as a Linked Segment through cross-referencing each other with SegmentUID, PrevUID, and NextUID as in this table.
file name | SegmentUID | PrevUID | NextUID |
---|---|---|---|
start.mkv | 71000c23cd31099853fbc94dd984a5dd | n/a | a77b3598941cb803eac0fcdafe44fac9 |
middle.mkv | a77b3598941cb803eac0fcdafe44fac9 | 71000c23cd31099853fbc94dd984a5dd | 6c92285fa6d3e827b198d120ea3ac674 |
end.mkv | 6c92285fa6d3e827b198d120ea3ac674 | a77b3598941cb803eac0fcdafe44fac9 | n/a |
Soft Linking is used by codec chapters. They can reference another Segment and jump to that Segment. The way the Segments are described are internal to the chapter codec and unknown to the Matroska level. But there are Elements within the Info Element (such as ChapterTranslate) that can translate a value representing a Segment in the chapter codec and to the current SegmentUID. All Segments that could be used in a Linked Segment in this way SHOULD be marked as members of the same family via the SegmentFamily Element, so that the player can quickly switch from one to the other.
Medium Linking creates relationships between Segments using Ordered Chapters and the ChapterSegmentUID Element. A Segment Edition with Ordered Chapters MAY contain Chapters that reference timestamp ranges from other Segments. The Segment referenced by the Ordered Chapter via the ChapterSegmentUID Element SHOULD be played as part of a Linked Segment. The timestamps of Segment content referenced by Ordered Chapters MUST be adjusted according to the cumulative duration of the the previous Ordered Chapters.
As an example a file named intro.mkv could have a SegmentUID of 0xb16a58609fc7e60653a60c984fc11ead. Another file called program.mkv could use a Chapter Edition that contains two Ordered Chapters. The first chapter references the Segment of intro.mkv with the use of a ChapterSegmentUID, ChapterSegmentEditionUID, ChapterTimeStart and optionally a ChapterTimeEnd element. The second chapter references content within the Segment of program.mkv. A player SHOULD recognize the Linked Segment created by the use of ChapterSegmentUID in an enabled Edition and present the reference content of the two Segments together.
The TimecodeScale is used to calculate the Raw Timecode of a Block. The timecode is obtained by adding the Block's timecode to the Cluster's Timecode, and then multiplying that result by the TimecodeScale. The result will be the Block's Raw Timecode in nanoseconds. The formula for this would look like:
(a + b) * c a = [Block's Timecode]({{site.baseurl}}/index.html#block-header) b = [Cluster's](#cluster) [Timecode](#timecode) c = [TimeCodeScale]({{site.baseurl}}/index.html#TimeCodeScale)
An example of this is, assume a Cluster's Timecode has a value of 564264, the Block has a Timecode of 1233, and the timecodescale is the default of 1000000.
(1233 + 564264) * 1000000 = 565497000000
So, the Block in this example has a specific time of 565497000000 in nanoseconds. In milliseconds this would be 565497ms.
Because the default value of TimecodeScale is 1000000, which makes each integer in the Cluster and Block timecodes equal 1ms, this is the most commonly used. When dealing with audio, this causes innaccuracy with where you are seeking to. When the audio is combined with video, this is not an issue. For most cases the the synch of audio to video does not need to be more than 1ms accurate. This becomes obvious when one considers that sound will take 2-3ms to travel a single meter, so distance from your speakers will have a greater effect on audio/visual synch than this.
However, when dealing with audio only files, seeking accuracy can become critical. For instance, when storing a whole CD in a single track, you want to be able to seek to the exact sample that a song begins at. If you seek a few sample ahead or behind then a 'crack' or 'pop' may result as a few odd samples are rendered. Also, when performing precise editing, it may be very useful to have the audio accuracy down to a single sample.
It is usually true that when storing timecodes for an audio stream, the TimecodeScale MUST have an accuracy of at least that of the audio samplerate, otherwise there are rounding errors that prevent you from knowing the precise location of a sample. Here's how a program has to round each timecode in order to be able to recreate the sample number accurately.
Let's assume that the application has an audio track with a sample rate of 44100. As written above the TimecodeScale MUST have at least the accuracy of the sample rate itself: 1000000000 / 44100 = 22675.7369614512. This value MUST always be truncated. Otherwise the accuracy will not suffice. So in this example the application wil use 22675 for the TimecodeScale. The application could even use some lower value like 22674 which would allow it to be a little bit imprecise about the original timecodes. But more about that in a minute.
Next the application wants to write sample number 52340 and calculates the timecode. This is easy. In order to calculate the Raw Timecode in ns all it has to do is calculate RawTimecode = round(1000000000 * sample_number / sample_rate). Rounding at this stage is very important! The application might skip it if it choses a slightly smaller value for the TimecodeScale factor instead of the truncated one like shown above. Otherwise it has to round or the results won't be reversible. For our example we get RawTimecode = round(1000000000 * 52340 / 44100) = round(1186848072.56236) = 1186848073.
The next step is to calculate the Absolute Timecode - that is the timecode that will be stored in the Matroska file. Here the application has to divide the Raw Timecode from the previous paragraph by the TimecodeScale factor and round the result: AbsoluteTimecode = round(RawTimecode / TimecodeScale_facotr) which will result in the following for our example: AbsoluteTimecode = round(1186848073 / 22675) = round(52341.7011245866) = 52342. This number is the one the application has to write to the file.
Now our file is complete, and we want to play it back with another application. Its task is to find out which sample the first application wrote into the file. So it starts reading the Matroska file and finds the TimecodeScale factor 22675 and the audio sample rate 44100. Later it finds a data block with the Absolute Timecode of 52342. But how does it get the sample number from these numbers?
First it has to calculate the Raw Timecode of the block it has just read. Here's no rounding involved, just an integer multiplication: RawTimecode = AbsoluteTimecode * TimecodeScale_factor. In our example: RawTimecode = 52342 * 22675 = 1186854850.
The conversion from the RawTimecode to the sample number again requires rounding: sample_number = round(RawTimecode * sample_rate / 1000000000). In our example: sample_number = round(1186854850 * 44100 / 1000000000) = round(52340.298885) = 52340. This is exactly the sample number that the previous program started with.
Some general notes for a program:
The "default track" flag is a hint for the playback application and SHOULD always be changeable by the user. If the user wants to see or hear a track of a certain kind (audio, video, subtitles) and she hasn't chosen a specific track then the player SHOULD use the first track of that kind whose "default track" flag is set to "1". If no such track is found then the first track of this kind SHOULD be chosen.
Only one track of a kind MAY have its "default track" flag set in a segment. If a track entry does not contain the "default track" flag element then its default value "1" is to be used.
The "forced" flag tells the playback application that it MUST display/play this track or another track of the same kind that also has its "forced" flag set. When there are multiple "forced" tracks, the player SHOULD determined based upon the language of the forced flag or use the default flag if no track matches the use languages. Another track of the same kind without the "forced" flag may be use simultaneously with the "forced" track (like DVD subtitles for example).
The TrackTimecodeScale is used align tracks that would otherwise be played at different speeds. An example of this would be if you have a film that was originally recorded at 24fps video. When playing this back through a PAL broadcasting system, it is standard to speed up the film to 25fps to match the 25fps display speed of the PAL broadcasting standard. However, when broadcasting the video through NTSC, it is typical to leave the film at its original speed. If you wanted to make a single file where there was one video stream, and an audio stream used from the PAL broadcast, as well as an audio stream used from the NTSC broadcast, you would have the problem that the PAL audio stream would be 1/24th faster than the NTSC audio stream, quickly leading to problems. It is possible to stretch out the PAL audio track and reencode it at a slower speed, however when dealing with lossy audio codecs, this often results in a loss of audio quality and/or larger file sizes.
This is the type of problem that TrackTimecodeScale was designed to fix. Using it, the video can be played back at a speed that will synch with either the NTSC or the PAL audio stream, depending on which is being used for playback. To continue the above example:
Track 1: Video Track 2: NTSC Audio Track 3: PAL Audio
Because the NTSC track is at the original speed, it will used as the default value of 1.0 for its TrackTimecodeScale. The video will also be aligned to the NTSC track with the default value of 1.0.
The TrackTimecodeScale value to use for the PAL track would be calculated by determining how much faster the PAL track is than the NTSC track. In this case, because we know the video for the NTSC audio is being played back at 24fps and the video for the PAL audio is being played back at 25fps, the calculation would be:
(25 / 24) = ~ 1.04166666666666666667
When writing a file that uses a non-default TrackTimecodeScale, the values of the Block's timecode are whatever they would be when normally storing the track with a default value for the TrackTimecodeScale. However, the data is interleaved a little differently. Data SHOULD be interleaved by its Raw Timecode in the order handed back from the encoder. The Raw Timecode of a Block from a track using TrackTimecodeScale is calculated using:
(Block's Timecode + Cluster's Timecode) * TimecodeScale * TrackTimecodeScale
So, a Block from the PAL track above that had a Scaled Timecode of 100 seconds would have a Raw Timecode of 104.66666667 seconds, and so would be stored in that part of the file.
When playing back a track using the TrackTimecodeScale, if the track is being played by itself, there is no need to scale it. From the above example, when playing the Video with the NTSC Audio, neither are scaled. However, when playing back the Video with the PAL Audio, the timecodes from the PAL Audio track are scaled using the TrackTimecodeScale, resulting in the video playing back in synch with the audio.
It would be possible for a player to also adjust the audio's samplerate at the same time as adjusting the timecodes if you wanted to play the two audio streams synchronously. It would also be possible to adjust the video to match the audio's speed. However, for playback, the selected track(s) timecodes SHOULD be adjusted if they need to be scaled.
While the above example deals specifically with audio tracks, this element can be used to align video, audio, subtitles, or any other type of track contained in a Matroska file.
Matroska is based upon the principal that a reading application does not have to support 100% of the specifications in order to be able to play the file. A Matroska file therefore 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 contains Matroska Elements from a higher specification version number while signalling that a reading application MUST only support a lower version number properly in order to play it back (possibly with a reduced feature set). This implies that a reading application supporting at least Matroska version V reading a file whose DocTypeReadVersion field is equal to or lower than V MUST skip Matroska/EBML Elements it encounters but which it does not know about if that unknown element fits into the size constraints set by the current parent element.
There are 2 different ways to compress 3D videos: have each 'eye' track in a separate track and 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 the StereoMode Element which defines how planes are assembled in the track (mono or left-right combined). Odd values of StereoMode means the left plane comes first for more convenient reading. The pixel count of the track (PixelWidth/PixelHeight) is the raw amount of pixels (for example 3840x1080 for full HD side by side) and the DisplayWidth/Height in 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 colours 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) which consists of packing 2 frames together in a Block using lacing. The first frame is the left eye and the other frame is the right eye (or vice versa). The frames SHOULD be decoded in that order and are possibly dependent on each other (P and B frames).
For separate tracks, Matroska needs to define exactly which track does what. TrackOperation with TrackCombinePlanes do that. For more details look at how TrackOperation works.
The 3D support is still in infancy and may evolve to support more features.
TrackOperation allows combining multiple tracks to make a virtual one. It uses 2 separate system to combine tracks. One to create a 3D "composition" (left/right/background planes) and one to simplify join 2 tracks together to make a single track.
A track created with TrackOperation 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 its own decoder before the "operation" is applied. The Cues corresponding to such a virtual track SHOULD be the sum of the Cues elements for each of the tracks it's composed of (when the Cues are defined per track).
In the case of TrackJoinBlocks, the Blocks (from BlockGroup and SimpleBlock) of all the tracks SHOULD be used as if they were defined for this new virtual Track. When 2 Blocks have overlapping start or end timecodes, it's up to the underlying system to either drop some of these frames or render them the way they overlap. In the end this situation SHOULD be avoided when creating such tracks as you can never be sure of the end result on different platforms.
Except for the EBML Header and the CRC-32 Element, the EBML specification does not require any particular storage order for Elements. The Matroska specification however defines mandates and recommendations for ordering certain Elements in order to facilitate better playback, seeking, and editing efficiency. This section describes and offers rationale for ordering requirements and recommendations for Matroska.
A valid Matroska file requires only one Top-Level Element, the Info Element; however, to be playable Matroska MUST also contain at least one Tracks and Cluster Element. The first Info Element and the first Tracks Element MUST either be stored before the first Cluster Element or both be referenced by a SeekHead Element which occurs before the first Cluster Element.
After a Matroska file has been created it could still be edited. For example chapters, tags or attachments can be added. When new Top-Level Elements are added to a Matroska file the SeekHead Element(s) MUST be updated so that the SeekHead Element(s) itemize the identity and position of all Top-Level Elements. Editing, removing, or adding Elements to a Matroska file often requires that some existing Elements be voided or extended; therefore, it is RECOMMENDED to use Void Elements as padding in between Top-Level Elements.
As noted by the EBML specification, if a CRC-32 Element is used then the CRC-32 Element MUST be the first ordered Element within its Parent Element. The Matroska specification recommends that CRC-32 Elements SHOULD NOT be used as an immediate Child Element of the Segment Element; however all Top-Level Elements of an EBML Document SHOULD include a CRC-32 Element as a Child Element.
If used, the first SeekHead Element SHOULD be the first non-CRC-32 Child Element of the Segment Element. If a second SeekHead Element is used then the first SeekHead MUST reference the identity and position of the second SeekHead, the second SeekHead MUST only reference Cluster Elements and not any other Top-Level Element already contained within the first SeekHead, and the second SeekHead MAY be stored in any order relative to the other Top-Level Elements. Whether one or two SeekHead Element(s) are used, the SeekHead Element(s) MUST collectively reference the identity and position of all Top-Level Elements except for the first SeekHead itself.
It is RECOMMENDED that the first SeekHead Element be followed by some padding (a Void Element) to allow for the SeekHead Element to be expanded to cover new Top-Level Elements that could be added to the Matroska file, such as Tags, Chapters and Attachments Elements.
The Cues Element is RECOMMENDED to optimize seeking access in Matroska. It is programmatically simpler to add the Cues Element after all of the Cluster Elements are written because this does not require a prediction of how much space to reserve before writing the Cluster Elements. On the other hand, storing the Cues Element before the Clusters can provide some seeking advantages.
The first Info Element SHOULD occur before the first Tracks and first Cluster Element.
The Chapters Element SHOULD be placed before the Cluster Element(s). The Chapters Element can be used during playback even if the user doesn't need to seek. It immediately gives the user information of what section is being read and what other sections are available. In the case of Ordered Chapters it RECOMMENDED to evaluate the logical linking even before starting playing anything. The Chapters Element SHOULD be placed before the first Tracks Element and after the first Info Element.
The Attachments Element is not meant to use by default when playing the file, but could contain the cover art and/or fonts. Cover art is useful even before the file is played and fonts could be needed before playback starts for initialization of subtitles that could use them. The Attachments Element MAY be placed before the first Cluster Element; however if the Attachments Element is likely to be edited, then it SHOULD be placed after the last Cluster Element.
The Tags Element is the one that is most subject to changes after the file was originally created. So for easier editing the Tags Element SHOULD be placed at the end of the Segment Element, even after the Attachments Element. On the other hand, it is inconvenient to have to seek in the Segment for tags especially for network streams. So it's better if the Tags Element(s) are found early in the stream. When editing the Tags Element(s), the original Tags Element at the beginning can be voided and a new one written right at the end of the Segment Element. The file size will only marginally change.
As each BlockGroup and SimpleBlock of a Cluster Element needs the Cluster Timecode, the Timecode Element MUST occur as the first Child Element within the Cluster Element.
As an additional resource to this page Haali has created a list of codec IDs in a PDF.
For each TrackEntry inside matroska, there has to be a CodecID defined. This ID is represent the codec used to encode data in the Track. The codec works with the coded data in the stream, but also with some codec initialisation. There are 2 different kind of codec "initialisation":
Each of these elements contain the same kind of data. And these data depend on the codec used.
Important Note:
The intention behind this list is NOT to list all existing audio and video codecs, but rather to list those codecs that are currently supported in Matroska and therefore need a well defined codec ID so that all developers supporting Matroska will use the same ID. If you feel we missed support for a very important codec, please tell us on our development mailing list (matroska-devel at lists.matroska.org).
Codec ID: "V_MS/VFW/FOURCC"
Codec Name: Microsoft (TM) Video Codec Manager (VCM)
Description: The private data contains the VCM structure BITMAPINFOHEADER including the extra private bytes, as defined by Microsoft. The data are stored in little endian format (like on IA32 machines). Where is the Huffman table stored in HuffYUV, not AVISTREAMINFO ??? And the FourCC, not in AVISTREAMINFO.fccHandler ???
Codec ID: V_UNCOMPRESSED
Codec Name: Video, raw uncompressed video frames
Description: The private data is void, all details about the used colour specs and bit depth are to be put/read from the KaxCodecColourSpace elements.
Codec ID: V_MPEG4/ISO/???
Codec Name: MPEG4 ISO Profile Video
Description: The stream complies with, and uses the CodecID for, one of the MPEG-4 profiles listed below.
Codec ID: V_MPEG4/ISO/SP
Codec Name: MPEG4 ISO simple profile (DivX4)
Description: Stream was created via improved codec API (UCI) or even transmuxed from AVI (no b-frames in Simple Profile), frame order is coding order
Codec ID: V_MPEG4/ISO/ASP
Codec Name: MPEG4 ISO advanced simple profile (DivX5, XviD, FFMPEG)
Description: Stream was created via improved codec API (UCI) or transmuxed from MP4, not simply transmuxed from AVI! Note there are differences how b-frames are handled in these native streams, when being compared to a VfW created stream, as here there are no dummy frames inserted, the frame order is exactly the same as the coding order, same as in MP4 streams!
Codec ID: V_MPEG4/ISO/AP
Codec Name: MPEG4 ISO advanced profile
Description: (Same as above)
Codec ID: V_MPEG4/MS/V3
Codec Name: Microsoft (TM) MPEG4 V3
Description: and derivates, means DivX3, Angelpotion, SMR, etc.; stream was created using VfW codec or transmuxed from AVI; note that V1/V2 are covered in VfW compatibility mode
Codec ID: V_MPEG1
Codec Name: MPEG 1
Description: The matroska video stream will contain a demuxed Elementary Stream (ES ), where block boundaries are still to be defined. Its RECOMMENDED to use MPEG2MKV.exe for creating those files, and to compare the results with selfmade implementations
Codec ID: V_MPEG2
Codec Name: MPEG 2
Description: The matroska video stream will contain a demuxed Elementary Stream (ES ), where block boundaries are still to be defined. Its RECOMMENDED to use MPEG2MKV.exe for creating those files, and to compare the results with selfmade implementations
Codec ID: V_REAL/????
Codec Name: Real Video(TM)
Description: The stream is one of the Real Video(TM) video streams listed below. Source for the codec names are from Karl Lillevold on Doom9. The CodecPrivate element contains a "real_video_props_t" structure in Big Endian byte order as found in librmff.
Codec ID: V_REAL/RV10
Codec Name: RealVideo 1.0 aka RealVideo 5
Description: Individual slices from the Real container are combined into a single frame.
Codec ID: V_REAL/RV20
Codec Name: RealVideo G2 and RealVideo G2+SVT
Description: Individual slices from the Real container are combined into a single frame.
Codec ID: V_REAL/RV30
Codec Name: RealVideo 8
Description: Individual slices from the Real container are combined into a single frame.
Codec ID: V_REAL/RV40
Codec Name: rv40 : RealVideo 9
Description: Individual slices from the Real container are combined into a single frame.
Codec ID: V_QUICKTIME
Codec Name: Video taken from QuickTime(TM) files
Description: Several codecs as stored in QuickTime, e.g. Sorenson or Cinepak. The CodecPrivate contains all additional data that is stored in the 'stsd' (sample description) atom in the QuickTime file after the mandatory video descriptor structure (starting with the size and FourCC fields). For an explanation of the QuickTime file format read QuickTime File Format Specification.
Codec ID: V_THEORA
Codec Name: Theora
Description: The private data contains the first three Theora packets in order. The lengths of the packets precedes them. The actual layout is:
Codec ID: V_PRORES
Codec Name: Apple ProRes
Description: The private data contains the fourcc as found in MP4 movies:
this page for more technical details on ProRes
Codec ID: A_MPEG/L3
Codec Name: MPEG Audio 1, 2, 2.5 Layer III
Description: The private data is void. The data contain everything needed for playback in the MPEG Audio header of each frame. Corresponding ACM wFormatTag : 0x0055
Codec ID: A_MPEG/L2
Codec Name: MPEG Audio 1, 2 Layer II
Description: The private data is void. The data contain everything needed for playback in the MPEG Audio header of each frame. Corresponding ACM wFormatTag : 0x0050
Codec ID: A_MPEG/L1
Codec Name: MPEG Audio 1, 2 Layer I
Description: The private data is void. The data contain everything needed for playback in the MPEG Audio header of each frame. Corresponding ACM wFormatTag : 0x0050
Codec ID: A_PCM/INT/BIG
Codec Name: PCM Integer Big Endian
Description: The private data is void. The bitdepth has to be read and set from KaxAudioBitDepth element. Corresponding ACM wFormatTag : ???
Codec ID: A_PCM/INT/LIT
Codec Name: PCM Integer Little Endian
Description: The private data is void. The bitdepth has to be read and set from KaxAudioBitDepth element. Corresponding ACM wFormatTag : 0x0001
Codec ID: A_PCM/FLOAT/IEEE
Codec Name: Floating Point, IEEE compatible
Description: The private data is void. The bitdepth has to be read and set from KaxAudioBitDepth element (32 bit in most cases). The float are stored in little endian order (most common float format). Corresponding ACM wFormatTag : 0x0003
Codec ID: A_MPC
Codec Name: MPC (musepack) SV8
Description: The main developer for musepack has requested that we wait until the SV8 framing has been fully defined for musepack before defining how to store it in Matroska.
Codec ID: A_AC3
Codec Name: (Dolby™) AC3
Description: BSID <= 8 !! The private data is void ??? Corresponding ACM wFormatTag : 0x2000 ; channel number have to be read from the corresponding audio element
Codec ID: A_AC3/BSID9
Codec Name: (Dolby™) AC3
Description: The ac3 frame header has, similar to the mpeg-audio header a version field. Normal ac3 is defiened as bitstream id 8 (5 Bits, numbers are 0-15). Everything below 8 is still compatible with all decoders that handle 8 correctly. Everything higher are additions that break decoder compatibility. For the samplerates 24kHz (00); 22,05kHz (01) and 16kHz (10) the BSID is 9 For the samplerates 12kHz (00); 11,025kHz (01) and 8kHz (10) the BSID is 10
Codec ID: A_AC3/BSID10
Codec Name: (Dolby™) AC3
Description: (Same as above)
Codec ID: A_ALAC
Codec Name: ALAC (Apple Lossless Audio Codec)
Description: The private data contains ALAC's magic cookie (both the codec specific configuration as well as the optional channel layout information). Its format is described in ALAC's official source code.
Codec ID: A_DTS
Codec Name: Digital Theatre System
Description: Supports DTS, DTS-ES, DTS-96/26, DTS-HD High Resolution Audio and DTS-HD Master Audio. The private data is void. Corresponding ACM wFormatTag : 0x2001
Codec ID: A_DTS/EXPRESS
Codec Name: Digital Theatre System Express
Description: DTS Express (a.k.a. LBR) audio streams. The private data is void. Corresponding ACM wFormatTag : 0x2001
Codec ID: A_DTS/LOSSLESS
Codec Name: Digital Theatre System Lossless
Description: DTS Lossless audio that does not have a core substream. The private data is void. Corresponding ACM wFormatTag : 0x2001
Codec ID: A_VORBIS
Codec Name: Vorbis
Description: The private data contains the first three Vorbis packet in order. The lengths of the packets precedes them. The actual layout is: Byte 1: number of distinct packets '#p' minus one inside the CodecPrivate block. This MUST be '2' for current (as of 2016-07-08) Vorbis headers. Bytes 2..n: lengths of the first '#p' packets, coded in Xiph-style lacing. The length of the last packet is the length of the CodecPrivate block minus the lengths coded in these bytes minus one. Bytes n+1..: The Vorbis identification header, followed by the Vorbis comment header followed by the codec setup header.
Codec ID: A_FLAC
Codec Name: FLAC (Free Lossless Audio Codec)
Description: The private data contains all the header/metadata packets before the first data packet. These include the first header packet containing only the word fLaC as well as all metadata packets.
Codec ID: A_REAL/????
Codec Name: Realmedia Audio codecs
Description: The stream contains one of the following audio codecs. In each case the CodecPrivate element contains either the "real_audio_v4_props_t" or the "real_audio_v5_props_t" structure (differentiated by their "version" field; Big Endian byte order) as found in librmff.
Codec ID: A_REAL/14_4
Codec Name: Real Audio 1
Description:
Codec ID: A_REAL/28_8
Codec Name: Real Audio 2
Description:
Codec ID: A_REAL/COOK
Codec Name: Real Audio Cook Codec (codename: Gecko)
Description:
Codec ID: A_REAL/SIPR
Codec Name: Sipro Voice Codec
Description:
Codec ID: A_REAL/RALF
Codec Name: Real Audio Lossless Format
Description:
Codec ID: A_REAL/ATRC
Codec Name: Sony Atrac3 Codec
Description:
Codec ID: A_MS/ACM
Codec Name: Microsoft(TM) Audio Codec Manager (ACM)
Description: The private data contains the ACM structure WAVEFORMATEX including the extra private bytes, as defined by Microsoft. The data are stored in little endian format (like on IA32 machines).
Codec ID: A_AAC/?????/???
Codec Name: AAC Profile Audio
Description: The stream complies with, and uses the CodecID for, one of the AAC profiles listed below. AAC audio always uses wFormatTag 0xFF
Codec ID: A_AAC/MPEG2/MAIN
Codec Name: MPEG2 Main Profile
Description: The private data is void. Channel number and sample rate have to be read from the corresponding audio element. Audio stream is stripped from ADTS headers and normal matroska frame based muxing scheme is applied.
Codec ID: A_AAC/MPEG2/LC
Codec Name: Low Complexity
Description: The private data is void. Channel number and sample rate have to be read from the corresponding audio element. Audio stream is stripped from ADTS headers and normal matroska frame based muxing scheme is applied.
Codec ID: A_AAC/MPEG2/LC/SBR
Codec Name: Low Complexity with Spectral Band Replication
Description: The private data is void. Channel number and sample rate have to be read from the corresponding audio element. Audio stream is stripped from ADTS headers and normal matroska frame based muxing scheme is applied.
Codec ID: A_AAC/MPEG2/SSR
Codec Name: Scalable Sampling Rate
Description: The private data is void. Channel number and sample rate have to be read from the corresponding audio element. Audio stream is stripped from ADTS headers and normal matroska frame based muxing scheme is applied.
Codec ID: A_AAC/MPEG4/MAIN
Codec Name: MPEG4 Main Profile
Description: The private data is void. Channel number and sample rate have to be read from the corresponding audio element. Audio stream is stripped from ADTS headers and normal matroska frame based muxing scheme is applied.
Codec ID: A_AAC/MPEG4/LC
Codec Name: Low Complexity
Description: The private data is void. Channel number and sample rate have to be read from the corresponding audio element. Audio stream is stripped from ADTS headers and normal matroska frame based muxing scheme is applied.
Codec ID: A_AAC/MPEG4/LC/SBR
Codec Name: Low Complexity with Spectral Band Replication
Description: The private data is void. Channel number and sample rate have to be read from the corresponding audio element. Audio stream is stripped from ADTS headers and normal matroska frame based muxing scheme is applied.
Codec ID: A_AAC/MPEG4/SSR
Codec Name: Scalable Sampling Rate
Description: The private data is void. Channel number and sample rate have to be read from the corresponding audio element. Audio stream is stripped from ADTS headers and normal matroska frame based muxing scheme is applied.
Codec ID: A_AAC/MPEG4/LTP
Codec Name: Long Term Prediction
Description: The private data is void. Channel number and sample rate have to be read from the corresponding audio element. Audio stream is stripped from ADTS headers and normal matroska frame based muxing scheme is applied.
Codec ID: A_QUICKTIME
Codec Name: Audio taken from QuickTime(TM) files
Description: Several codecs as stored in QuickTime, e.g. QDesign Music v1 or v2. The CodecPrivate contains all additional data that is stored in the 'stsd' (sample description) atom in the QuickTime file after the mandatory sound descriptor structure (starting with the size and FourCC fields). For an explanation of the QuickTime file format read QuickTime File Format Specification.
Codec ID: A_QUICKTIME/????
Codec Name: QuickTime audio codecs
Description: This CodecID is deprecated in favor of A_QUICKTIME (without a trailing codec name). Otherwise the storage is identical; see A_QUICKTIME for details.
Codec ID: A_QUICKTIME/QDMC
Codec Name: QDesign Music
Description:
Codec ID: A_QUICKTIME/QDM2
Codec Name: QDesign Music v2
Description:
Codec ID: A_TTA1
Codec Name: The True Audio lossles audio compressor
Description: TTA format description Each frame is kept intact, including the CRC32. The header and seektable are dropped. The private data is void. SamplingFrequency, Channels and BitDepth are used in the TrackEntry. wFormatTag = 0x77A1
Codec ID: A_WAVPACK4
Codec Name: WavPack lossles audio compressor
Description: The Wavpack packets consist of a stripped header followed by the frame data. For multi-track (> 2 tracks) a frame consists of many packets. For hybrid files (lossy part + correction part), the correction part is stored in an additional block (level 1). For more details, check the WavPack muxing description.
Codec ID: S_TEXT/UTF8
Codec Name: UTF-8 Plain Text
Description: Basic text subtitles. For more information, please look at the Subtitle specifications.
Codec ID: S_TEXT/SSA
Codec Name: Subtitles Format
Description: The [Script Info] and [V4 Styles] sections are stored in the codecprivate. Each event is stored in its own Block. For more information, please read the specs for SSA/ASS.
Codec ID: S_TEXT/ASS
Codec Name: Advanced Subtitles Format
Description: The [Script Info] and [V4 Styles] sections are stored in the codecprivate. Each event is stored in its own Block. For more information, please read the specs for SSA/ASS.
Codec ID: S_TEXT/USF
Codec Name: Universal Subtitle Format
Description: This is mostly defined, but not typed out yet. It will first be available on the USF specs page.
Codec ID: S_TEXT/WEBVTT
Codec Name: Web Video Text Tracks Format (WebVTT)
Description: Advanced text subtitles. For more information about the storage please look at the WebVTT in Matroska specifications.
Codec ID: S_IMAGE/BMP
Codec Name: Bitmap
Description: Basic image based subtitle format; The subtitles are stored as images, like in the DVD. The timestamp in the block header of matroska indicates the start display time, the duration is set with the Duration element. The full data for the subtitle bitmap is stored in the Block's data section.
Codec ID: S_VOBSUB
Codec Name: VobSub subtitles
Description: The same subtitle format used on DVDs. Supoprted is only format version 7 and newer. VobSubs consist of two files, the .idx containing information, and the .sub, containing the actual data. The .idx file is stripped of all empty lines, of all comments and of lines beginning with alt: or langidx:. The line beginning with id: SHOULD be transformed into the appropriate Matroska track language element and is discarded. All remaining lines but the ones containing timestamps and file positions are put into the CodecPrivate element. For each line containing the timestamp and file position data is read from the appropriate position in the .sub file. This data consists of a MPEG program stream which in turn contains SPU packets. The MPEG program stream data is discarded, and each SPU packet is put into one Matroska frame.
Codec ID: S_KATE
Codec Name: Karaoke And Text Encapsulation
Description: A subtitle format developped for ogg. The mapping for Matroska is described on the Xiph wiki. As for Theora and Vorbis, Kate headers are stored in the private data as xiph-laced packets.
Codec ID: B_VOBBTN
Codec Name: VobBtn Buttons
Description: Based on MPEG/VOB PCI packets. The file contains a header consisting of the string "butonDVD" followed by the width and height in pixels (16 bits integer each) and 4 reserved bytes. The rest is full PCI packets. #Chapters
In this example a movie is split in different chapters. It could also just be an audio file (album) on which each track corresponds to a chapter.
This would translate in the following matroska form :
| Chapters | EditionEntry | ChapterAtom | ChapterUID | 0x123456 | ChapterTimeStart | 0 ns | ChapterTimeEnd | 5,000,000 ns | ChapterDisplay | ChapterString | Intro | ChapterLanguage | eng | ChapterAtom | ChapterUID | 0x234567 | ChapterTimeStart | 5,000,000 ns | ChapterTimeEnd | 25,000,000 ns | ChapterDisplay | ChapterString | Before the crime | ChapterLanguage | eng | ChapterDisplay | ChapterString | Avant le crime | ChapterLanguage | fra | ChapterAtom | ChapterUID | 0x345678 | ChapterTimeStart | 25,000,000 ns | ChapterTimeEnd | 27,500,000 ns | ChapterDisplay | ChapterString | The crime | ChapterLanguage | eng | ChapterDisplay | ChapterString | Le crime | ChapterLanguage | fra | ChapterAtom | ChapterUID | 0x456789 | ChapterTimeStart | 27,500,000 ns | ChapterTimeEnd | 38,000,000 ns | ChapterDisplay | ChapterString | After the crime | ChapterLanguage | eng | ChapterDisplay | ChapterString | Après le crime | ChapterLanguage | fra | ChapterAtom | ChapterUID | 0x456789 | ChapterTimeStart | 38,000,000 ns | ChapterTimeEnd | 43,000,000 ns | ChapterDisplay | ChapterString | Credits | ChapterLanguage | eng | ChapterDisplay | ChapterString | Générique | ChapterLanguage | fra |
In this example an (existing) album is split into different chapters, and one of them contain another splitting.
| Chapters | EditionEntry | ChapterAtom | ChapterUID | 0x654321 | ChapterTimeStart | 0 ns | ChapterTimeEnd | 748,000,000 ns | ChapterDisplay | ChapterString | Baby wants to bleep/rock | ChapterAtom | ChapterUID | 0x123456 | ChapterTimeStart | 0 ns | ChapterTimeEnd | 278,000,000 ns | ChapterDisplay | ChapterString | Baby wants to bleep (pt.1) | ChapterAtom | ChapterUID | 0x234567 | ChapterTimeStart | 278,000,000 ns | ChapterTimeEnd | 432,000,000 ns | ChapterDisplay | ChapterString | Baby wants to rock | ChapterAtom | ChapterUID | 0x345678 | ChapterTimeStart | 432,000,000 ns | ChapterTimeEnd | 633,000,000 ns | ChapterDisplay | ChapterString | Baby wants to bleep (pt.2) | ChapterAtom | ChapterUID | 0x456789 | ChapterTimeStart | 633,000,000 ns | ChapterTimeEnd | 748,000,000 ns | ChapterDisplay | ChapterString | Baby wants to bleep (pt.3) | ChapterAtom | ChapterUID | 0x567890 | ChapterTimeStart | 750,000,000 ns | ChapterTimeEnd | 1,178,500,000 ns | ChapterDisplay | ChapterString | Bleeper_O+2 | ChapterAtom | ChapterUID | 0x678901 | ChapterTimeStart | 1,180,500,000 ns | ChapterTimeEnd | 1,340,000,000 ns | ChapterDisplay | ChapterString | Baby wants to bleep (pt.4) | ChapterAtom | ChapterUID | 0x789012 | ChapterTimeStart | 1,342,000,000 ns | ChapterTimeEnd | 1,518,000,000 ns | ChapterDisplay | ChapterString | Bleep to bleep | ChapterAtom | ChapterUID | 0x890123 | ChapterTimeStart | 1,520,000,000 ns | ChapterTimeEnd | 2,015,000,000 ns | ChapterDisplay | ChapterString | Baby wants to bleep (k) | ChapterAtom | ChapterUID | 0x901234 | ChapterTimeStart | 2,017,000,000 ns | ChapterTimeEnd | 2,668,000,000 ns | ChapterDisplay | ChapterString | Bleeper |
There are two important flags that apply to chapter atoms: enabled and hidden. The effect of those flags always applies to child atoms of an atom affected by that flag.
For example: Let's assume a parent atom with flag hidden set to true; that parent contains two child atom, the first with hidden set to true as well and the second child with the flag either set to false or not present at all (in which case the default value applies, and that again is false).
As the parent is hidden all of its children are initially hidden as well. However, when a control track toggles the parent's hidden flag to false then only the the parent and its second child will be visible. The first child's explicitely set flag retains its value until its value is toggled to false by a control track.
Corresponding behavior applies to the enabled flag.
The edition's hidden flag behaves much the same as the chapter's hidden flag: if an edition is hidden then none of its children SHALL be visible, no matter their own hidden flags. If the edition is toggled to being visible then the chapter atom's hidden flags decide whether or not the chapter is visible.
The menu features are handled like a chapter 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 the ChapProcessCodecID parameter. For now only 2 values are supported : 0 matroska script, 1 menu borrowed from the DVD. The private data depend on the type of menu system (stored in ChapProcessPrivate), idem for the data in the chapters (stored in ChapProcessData).
This is the case when ChapProcessCodecID = 0. This is a script language build for Matroska purposes. The inspiration comes from ActionScript, javascript and other similar scripting languages. The commands are stored as text commands, in UTF-8. The syntax is C like, with commands spanned on many lines, each terminating with a ";". You can also include comments at the end of lines with "//" or comment many lines using "/* */". The scripts are stored in ChapProcessData. For the moment ChapProcessPrivate is not used.
The one and only command existing for the moment is GotoAndPlay( ChapterUID );. As the same suggests, it means that when this command is encountered, the playback SHOULD jump to the Chapter specified by the UID and play it.
This is the case when ChapProcessCodecID = 1. Each level of a chapter corresponds to a logical level in the DVD system that is stored in the first octet of the ChapProcessPrivate. This DVD hierarchy is as follows:
| ChapProcessPrivate | DVD Name | Hierarchy | Commands Possible | Comment | | 0x30 | SS | DVD domain | - | First Play, Video Manager, Video Title | | 0x2A | LU | Language Unit | - | Contains only PGCs | | 0x28 | TT | Title | - | Contains only PGCs | | 0x20 | PGC | Program Group Chain (PGC) | * | | 0x18 | PG | Program 1 | Program 2 | Program 3 | - | | 0x10 | PTT | Part Of Title 1 | Part Of Title 2 | - | Equivalent to the chapters on the sleeve. | | 0x08 | CN | Cell 1 | Cell 2 | Cell 3 | Cell 4 | Cell 5 | Cell 6 | - |
You can also recover wether a Segment is a Video Manager (VMG), Video Title Set (VTS) or Video Title Set Menu (VTSM) from the ChapterTranslateID element found in the Segment Info. This field uses 2 octets as follows:
For instance, the menu part from VTS_01_0.VOB would be coded [1,0] and the content part from VTS_02_3.VOB would be [2,1]. The VMG is always [0,0]
The following octets of ChapProcessPrivate are as follows:
| Octet 1 | DVD Name | Following Octets | | 0x30 | SS | Domain name code (1: 0x00= First play, 0xC0= VMG, 0x40= VTSM, 0x80= VTS) + VTS(M) number (2) | | 0x2A | LU | Language code (2) + Language extension (1) | | 0x28 | TT | global Title number (2) + corresponding TTN of the VTS (1) | | 0x20 | PGC | PGC number (2) + Playback Type (1) + Disabled User Operations (4) | | 0x18 | PG | Program number (2) | | 0x10 | PTT | PTT-chapter number (1) | | 0x08 | CN | Cell number [VOB ID(2)][Cell ID(1)][Angle Num(1)] |
If the level specified in ChapProcessPrivate is a PGC (0x20), there is an octet called the Playback Type, specifying the kind of PGC defined:
The next 4 following octets correspond to the User Operation flags in the standard PGC. When a bit is set, the command SHOULD be disabled.
ChapProcessData contains the pre/post/cell commands in binary format as there are stored on a DVD. There is just an octet preceeding these data to specify the number of commands in the element. As follows: [# of commands(1)][command 1 (8)][command 2 (8)][command 3 (8)].
More information on the DVD commands and format on DVD-replica, where we got most of the info about it. You can also get information on DVD from the DVDinfo project.---
Because Matroska is a general container format, we try to avoid specifying the formats to store in it. This type of work is really outside of the scope of a container-only format. However, because the use of subtitles in A/V containers has been so limited (with the exception of DVD) we are taking the time to specify how to store some of the more common subtitle formats in Matroska. This is being done to help facilitate their growth. Otherwise, incompatabilities could prevent the standardization and use of subtitle storage.
This page is not meant to be a complete listing of all subtitle formats that will be used in Matroska, it is only meant to be a guide for the more common, current formats. It is possible that we will add future formats to this page as they are created, but it is not likely as any other new subtitle format designer would likely have their own specifications. Any specification listed here SHOULD be strictly adhered to or it SHOULD NOT use the corresponding Codec ID.
Here is a list of pointers for storing subtitles in Matroska:
The first image format that is a goal to import into Matroska is the VobSub subtitle format. This subtitle type is generated by exporting the subtitles from a DVD.
The requirement for muxing VobSub into Matroska is v7 subtitles (see first line of the .IDX file). If the version is smaller, you must remux them using the SubResync utility from VobSub 2.23 (or MPC) into v7 format. Generally any newly created subs will be in v7 format.
The .IFO file will not be used at all.
If there is more than one subtitle stream in the VobSub set, each stream will need to be seperated into seperate tracks for storage in Matroska. E.g. the VobSub file contains streams for both English and German subtitles. Then the resulting Matroska file SHOULD contain two tracks. That way the language information can be 'dropped' and mapped to Matroska's language tags.
The .IDX file is reformatted (see below) and placed in the CodecPrivate.
Each .BMP will be stored in its own Block. The Timestamp with be stored in the Blocks Timecode and the duration will be stored in the Default Duration.
Here is an example .IDX file:
# VobSub index file, v7 (do not modify this line!) # # To repair desyncronization, you can insert gaps this way: # (it usually happens after vob id changes) # # delay: [sign]hh:mm:ss:ms # # Where: # [sign]: +, - (optional) # hh: hours (0 <= hh) # mm/ss: minutes/seconds (0 <= mm/ss <= 59) # ms: milliseconds (0 <= ms <= 999) # # Note: You can't position a sub before the previous with a negative # value. # # You can also modify timestamps or delete a few subs you don't like. # Just make sure they stay in increasing order. # Settings # Original frame size size: 720x480 # Origin, relative to the upper-left corner, can be overloaded by # aligment org: 0, 0 # Image scaling (hor,ver), origin is at the upper-left corner or at # the alignment coord (x, y) scale: 100%, 100% # Alpha blending alpha: 100% # Smoothing for very blocky images (use OLD for no filtering) smooth: OFF # In millisecs fadein/out: 50, 50 # Force subtitle placement relative to (org.x, org.y) align: OFF at LEFT TOP # For correcting non-progressive desync. (in millisecs or hh:mm:ss:ms) # Note: Not effective in DirectVobSub, use "delay: ... " instead. time offset: 0 # ON: displays only forced subtitles, OFF: shows everything forced subs: OFF # The original palette of the DVD palette: 000000, 7e7e7e, fbff8b, cb86f1, 7f74b8, e23f06, 0a48ea, \ b3d65a, 6b92f1, 87f087, c02081, f8d0f4, e3c411, 382201, e8840b, fdfdfd # Custom colors (transp idxs and the four colors) custom colors: OFF, tridx: 0000, colors: 000000, 000000, 000000, \ 000000 # Language index in use langidx: 0 # English id: en, index: 0 # Decomment next line to activate alternative name in DirectVobSub / # Windows Media Player 6.x # alt: English # Vob/Cell ID: 1, 1 (PTS: 0) timestamp: 00:00:01:101, filepos: 000000000 timestamp: 00:00:08:708, filepos: 000001000
First, lines beginning with "#" are removed. These are comments to make text file editing easier, and as this is not a text file, they aren't needed.
Next remove the "langidx" and "id" lines. These are used to differenciate the subtitle streams and define the language. As the streams will be stored seperately anyway, there is no need to differenciate them here. Also, the language setting will be stored in the Matroska tags, so there is no need to store it here.
Finally, the "timestamp" will be used to set the Block's timecode. Once it is set there, there is no need for it to be stored here. Also, as it may interfere if the file is edited, it SHOULD NOT be stored here.
Once all of these items are removed, the data to store in the CodecPrivate SHOULD look like this:
size: 720x480 org: 0, 0 scale: 100%, 100% alpha: 100% smooth: OFF fadein/out: 50, 50 align: OFF at LEFT TOP time offset: 0 forced subs: OFF palette: 000000, 7e7e7e, fbff8b, cb86f1, 7f74b8, e23f06, 0a48ea, \ b3d65a, 6b92f1, 87f087, c02081, f8d0f4, e3c411, 382201, e8840b, fdfdfd custom colors: OFF, tridx: 0000, colors: 000000, 000000, 000000, \ 000000
There SHOULD also be two Blocks containing one image each with the timecodes "00:00:01:101" and "00:00:08:708".
SRT is perhaps the most basic of all subtitle formats.
It consists of four parts, all in text..
1. A number indicating which subtitle it is in the sequence. 2. The time that the subtitle appears on the screen, and then disappears. 3. The subtitle itself. 4. A blank line indicating the start of a new subtitle.
When placing SRT in Matroska, part 3 is converted to UTF-8 (S_TEXT/UTF8) and placed in the data portion of the Block. Part 2 is used to set the timecode of the Block, and BlockDuration element. Nothing else is used.
Here is an example SRT file:
|
1 00:02:17,440 --> 00:02:20,375 Senator, we're making our final approach into Coruscant.
2 00:02:20,476 --> 00:02:22,501 Very good, Lieutenant.
|
In this example, the text "Senator, we're making our final approach into Coruscant." would be converted into UTF-8 and placed in the Block. The timecode of the block would be set to "00:02:17,440". And the BlockDuration element would be set to "00:00:02,935".
The same is repeated for the next subtitle.
Because there are no general settings for SRT, the CodecPrivate is left blank.
SSA stands for Sub Station Alpha. It's the file format used by the popular subtitle editor, SubStation Alpha. This format is widely used by fansubbers.
It allows you to do some advanced display features, like positioning, karaoke, style managements...
For detailed information on SSA/ASS, see the SSA specs. It includes an SSA specs description and the avanced features added by ASS format (standing for Advanced SSA). Because SSA and ASS are so similar, they are treated the same here.
Like SRT, this format is text based with a particular syntax.
A file consists of 4 or 5 parts, declared ala INI file (but it's not an INI !)
The first, "[Script Info]" contains some information about the subtitle file, such as it's title, who created it, type of script and a very important one : "PlayResY". Be carefull of this value, everything in your script (font size, positioning) is scaled by it. Sub Station Alpha uses your desktops Y resolution to write this value, so if a friend with a large monitor and a high screen resolution gives you an edited script, you can mess everything up by saving the script in SSA with your low-cost monitor.
The second, "[V4 Styles]", is a list of style definitions. A style describe how will look a text on the screen. It defines font, font size, primary/.../outile colour, position, aligment etc ...
For example this :
|
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,0,1,1,2,2,5,5,30,0,0
|
The third, "[Events]", is the list of text you want to display at the right timing. You can specify some attribute here. Like the style to use for this event (MUST be defined in the list), the position of the text (Left, Right, Vertical Margin), an effect. Name is mostly used by translator to know who said this sentence. Timing is in h:mm:ss.cc (centisec).
|
Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: Marked=0,0:02:40.65,0:02:41.79,Wolf main,Cher,0000,0000,0000,,Et les enregistrements de ses ondes delta ? Dialogue: Marked=0,0:02:42.42,0:02:44.15,Wolf main,autre,0000,0000,0000,,Toujours rien.
|
"[Pictures]" or "[Fonts]" part can be found in some SSA file, they contains UUE-encoded pictures/font but those features are only used by Sub Station Alpha, i.e. no filter (Vobsub/Avery Lee Subtiler filter) use them.
Now, how are they stored in Matroska ?
Here is an example of an SSA file.
| [Script Info] ; This is a Sub Station Alpha v4 script. ; For Sub Station Alpha info and downloads, ; go to http://www.eswat.demon.co.uk/ ; or email kotus@eswat.demon.co.uk Title: Wolf's rain 2 Original Script: Anime-spirit Ishin-francais Original Translation: Coolman Original Editing: Spikewolfwood Original Timing: Lordalucard Original Script Checking: Spikewolfwood ScriptType: v4.00 Collisions: Normal PlayResY: 1024 PlayDepth: 0 Wav: 0, 128697,D:\Alex\Anime- Fansub -- TAFF -\Wolf's Rain\WR-_02Wav.wav Wav: 0, 120692,H:\team truc\WR-_02.wav Wav: 0, 116504,E:\sub\wolf's_rain\WOLF'S RAIN 02.wav LastWav: 3 Timer: 100,0000
[V4 Styles] Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding Style: Default,Arial,20,65535,65535,65535,-2147483640,-1,0,1,3,0,2,30,30,30,0,0 Style: Titre_episode,Akbar,140,15724527,65535,65535,986895,-1,0,1,1,0,3,30,30,30,0,0 Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,0,1,1,2,2,5,5,30,0,0
[Events] Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: Marked=0,0:02:40.65,0:02:41.79,Wolf main,Cher,0000,0000,0000,,Et les enregistrements de ses ondes delta ? Dialogue: Marked=0,0:02:42.42,0:02:44.15,Wolf main,autre,0000,0000,0000,,Toujours rien. |
Here is what would be placed into the CodecPrivate element.
| [Script Info] ; This is a Sub Station Alpha v4 script. ; For Sub Station Alpha info and downloads, ; go to http://www.eswat.demon.co.uk/ ; or email kotus@eswat.demon.co.uk Title: Wolf's rain 2 Original Script: Anime-spirit Ishin-francais Original Translation: Coolman Original Editing: Spikewolfwood Original Timing: Lordalucard Original Script Checking: Spikewolfwood ScriptType: v4.00 Collisions: Normal PlayResY: 1024 PlayDepth: 0 Wav: 0, 128697,D:\Alex\Anime- Fansub -- TAFF -\Wolf's Rain\WR-_02Wav.wav Wav: 0, 120692,H:\team truc\WR-_02.wav Wav: 0, 116504,E:\sub\wolf's_rain\WOLF'S RAIN 02.wav LastWav: 3 Timer: 100,0000
[V4 Styles] Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding Style: Default,Arial,20,65535,65535,65535,-2147483640,-1,0,1,3,0,2,30,30,30,0,0 Style: Titre_episode,Akbar,140,15724527,65535,65535,986895,-1,0,1,1,0,3,30,30,30,0,0 Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,0,1,1,2,2,5,5,30,0,0 |
And here are the two blocks that would be generated.
Block's timecode: 00:02:40.650 BlockDuration: 00:00:01.140
| 1,,Wolf main,Cher,0000,0000,0000,,Et les enregistrements de ses ondes delta ? |
Block's timecode: 00:02:42.420 BlockDuration: 00:00:01.730
| 2,,Wolf main,autre,0000,0000,0000,,Toujours rien. |
Under construction
The "Web Video Text Tracks Format" (short: WebVTT) is developed by the World Wide Web Consortium (W3C). Its specifications are freely available.
The guiding principles for the storage of WebVTT in Matroska are:
The CodecID to use is S_TEXT/WEBVTT.
This element contains all global blocks before the first subtitle entry. This starts at the "WEBVTT" file identification marker but excludes the optional byte order mark.
Non-global WebVTT blocks (e.g. "NOTE") before a WebVTT Cue Text are stored in Matroska's BlockAddition element together with the Matroska Block containing the WebVTT Cue Text these blocks precede (see below for the actual format).
Each WebVTT Cue Text is stored directly in the Matroska Block.
A muxer MUST change all WebVTT Cue Timestamps present within the Cue Text to be relative to the Matroska Block's timestamp.
The Cue's start timestamp is used as the Matroska Block's timestamp.
The difference between the Cue's end timestamp and its start timestamp is used as the Matroska Block's duration.
Each Matroska Block may be accompanied by one BlockAdditions element. Its format is as follows:
If there is no Matroska BlockAddition element stored together with the Matroska Block then all three components (Cue Settings List, Cue Identifier, Cue Comments) MUST be assumed to be absent.
Here's an example how a WebVTT is transformed.
Let's take the following example file:
The resulting CodecPrivate element will look like this:
Example Cue 1: timestamp 00:00:00.000, duration 00:00:10.000, Block's content:
BlockAddition's content starts with one empty line as there's no Cue Settings List:
Example Cue 2: timestamp 00:00:25.000, duration 00:00:10.000, Block's content:
BlockAddition's content starts with two empty lines as there's neither a Cue Settings List nor a Cue Identifier:
Example Cue 3: timestamp 00:01:03.000, duration 00:00:03.500, Block's content:
BlockAddition's content ends with an empty line as there's no Cue Identifier and there were no WebVTT Comment blocks:
Example Cue 4: timestamp 00:03:10.000, duration 00:00:10.000, Block's content:
Example entry 4: Entries can even include timestamps. For example:<00:00:05.000>This becomes visible five seconds after the first part.
This Block does not need a BlockAddition as the Cue did not contain an Identifier, nor a Settings List, and it wasn't preceded by Comment blocks.
Note: the storage of WebVTT in Matroska is not the same as the design document for storage of WebVTT in WebM. There are several reasons for this including but not limited to: the WebM document is old (from February 2012) and was based on an earlier draft of WebVTT and ignores several parts that were added to WebVTT later; WebM does still not support subtitles at all; the proposal suggests splitting the information across multiple tracks making demuxer's and remuxer's life very difficult.---
When a Tag is nested within another Tag, the nested Tag becomes an attribute of the base tag. For instance, if you wanted to store the dates that a singer used certain addresses for, that singer being the lead singer for a track that included multiple bands simultaneously, then your tag tree would look something like this: Targets - TrackUID BAND - LEADPERFORMER -- ADDRESS --- DATE --- DATEEND -- ADDRESS --- DATE In this way, it becomes possible to store any Tag as attributes of another tag. Multiple items SHOULD never be stored as a list in a single TagString. If there is more than one tag of a certain type to be stored, then more than one SimpleTag SHOULD be used. For authoring Tags outside of EBML, the following XML syntax is proposed used in mkvmerge. Binary data SHOULD be stored using BASE64 encoding if it is being stored at authoring time.
There is a debate between people who think all tags SHOULD be free and those who think all tags SHOULD be strict. If you look at this page you will realise we are in between.
Advanced-users application might let you put any tag in your file. But for the rest of the applications, they usually give you a basic list of tags you can use. Both have their needs. But it's usually a bad idea to use custom/exotic tags because you will probably be the only person to use this information even though everyone else could benefit from it. So hopefully when someone wants to put information in one's file, they will find an official one that fit them and hopefully use it ! If it's not in the list, this person can contact us any time for addition of such a missing tag. But it doesn't mean it will be accepted... Matroska files are not meant the become a whole database of people who made costumes for a film. A website would be better for that... It's hard to define what SHOULD be in and what doesn't make sense in a file. So we'll treat each request carefully.
We also need an official list simply for developpers to be able to display relevant information in their own design (if they choose to support a list of meta-information they SHOULD know which tag has the wanted meaning so that other apps could understand the same meaning).
To be able to save tags from other systems to Matroska we need to translate them to our system. There is a translation table on our site.
The TargetType element allows tagging of different parts that are inside or outside a given file. For example in an audio file with one song you could have information about the album it comes from and even the CD set even if it's not found in the file.
For application to know what kind of information (like TITLE) relates to a certain level (CD title or track title), we also need a set of official TargetType names. For now audio and video will have different values & names. That also means the same tag name can have different meanings depending on where it is (otherwise we would end up with 15 TITLE_ tags).
An upper level value tag applies to the lower level. That means if a CD has the same artist for all tracks, you just need to set the ARTIST tag at level 50 (ALBUM) and not to each TRACK (but you can). That also means that if some parts of the CD have no known ARTIST the value MUST be set to nothing (a void string "").
When a level doesn't exist it MUST NOT be specified in the files, so that the TOTAL_PARTS and PART_NUMBER elements match the same levels.
Here is an example of how these organizational tags work: If you set 10 TOTAL_PARTS to the ALBUM level (40) it means the album contains 10 lower parts. The lower part in question is the first lower level that is specified in the file. So if it's TRACK (30) then that means it contains 10 tracks. If it's MOVEMENT (20) that means it's 10 movements, etc.
The following is a complete list of the supported Matroska Tags. While it is possible to use Tag names that are not listed below, this is not reccommended as compatability will be compromised. If you find that there is a Tag missing that you would like to use, then please contact the Matroska team for its inclusion in the specifications before the format reaches 1.0.
Matroska supports storage of related files and data in the Attachments Top-Level Element. Attachments can be used to store related cover art, font files, transcripts, reports, or other ancilliary files related to the Segment.
Matroska supports attachments and they can be used for cover arts. This document defines a set of guidelines to add cover arts correctly in Matroska files.
The pictures SHOULD only use the JPEG and PNG picture formats.
There can be 2 different cover for a movie/album. A portrait one (like a DVD case) and a landscape one (like a banner ad for example, looking better on a wide screen).
There can be 2 versions of the same cover, the normal one and the small one. The dimension of the normal one SHOULD be 600 on the smallest side (eg 960x600 for landscape and 600x800 for portrait, 600x600 for square). The dimension of the small one SHOULD be 120 (192x120 or 120x160).
The way to differentiate between all these versions is by the filename. The default filename is cover.(png/jpg) for backward compatibility reasons. That is the "big" version of the file (600) in square or portrait mode. It SHOULD also be the first file in the attachments. The smaller resolution SHOULD be prefixed with "small_", ie small_cover.(jpg/png). The landscape variant SHOULD be suffixed with "_land", ie cover_land.jpg. The filenames are case sensitive and SHOULD all be lower case.
There is a sample file available to test player compatibility or to demonstrate the use of cover art in Matroska files.
There exist multiple ways to stream content. The term streaming itself is very vague. It means reading a file stored on a server. But the server could be very distant or very close. The transport system and the protocol used for streaming makes the whole difference.
In the case of Matroska, there are mostly 2 different kinds of stream: file access and live streaming.
File access can simply be reading a file located on your computer, but also accessing it from an HTTP (web) server or CIFS (windows share) server. All these protocols are usually safe from reading errors and seeking in the stream is possible. On other hand when the file is stored far away or on a slow server, seeking can be an expensive operation and SHOULD be avoided. That's why we set a few guidelines that, when followed, help reduce the number of seeking for regular playback and also have the playback start quickly without a lot of data needed to read first (like the Cues (index), Attachments or Meta Seek of all the Clusters).
Matroska having a small overhead, it is well suited for storing music/videos on file servers without having a big impact on the bandwidth used. It doesn't require to load the index before playing (the index can be loaded only when seeking is requested the first time), so playback can start very quickly too.
Live streaming is the equivalent of TV broadcasting on the internet. There are 2 families of servers for that. The RTP/RTSP ones and the HTTP servers. Matroska is not meant to be used over RTP. RTP already has timing and channel mechanisms that would wasted if doubled in Matroska. On the other hand live streaming of Matroska over HTTP (or any other plain protocol based on TCP) is very possible.
A live Matroska stream is different than a file, because it may have no known end (only when the client disconnects). For that the Segment MUST use the "unknown" size (all 1s in the size). The other option would be to concatenate Segments with known sizes one after the other. This solution allows a change of codec/resolution between each segment which can be useful in some cases (switch between 4:3 and 16:9 in some TV programs for example).
The Segment(s) being continuous, certain elements like Meta Seek, Cues, Chapters, Attachments MUST NOT be used in this context.
On the player side, it is possible to detect that a stream is not seekable. If the stream does not have a Meta Seek list or a Cues list at the beginning of the stream, it SHOULD be considered as non seekable. Even though it's still theoretically possible to seek blindly forward in the stream, if the server supports it.
In the context of a live radio or even web TV it is possible to "Tag" the content that is currently playing. The Tags level 1 element can be placed between Clusters each time necessary. In that case, the new Tags found MUST reset the previously encountered tags and use the new values instead (be they empty).
This document is a draft of the Menu system that will be the default one in Matroska. As it will just be composed of a Control Track, it will be seen as a "codec" and could be replaced later by something else if needed.
A menu is like what you see on DVDs, when you have some screens to select the audio format, subtitles or scene selection.
What we'll try to have is a system that can do almost everything done on a DVD, or more, or better, or drop the unused features if necessary.
As the name suggests, a Control Track is a track that can control the playback of the file and/or all the playback features. To make it as simple as possible for players, the Control Track will just give orders to the player and get the actions associated with the highlights/hotspots.
A hightlight is basically a rectangle/key associated with an action UID. When that rectangle/key is activated, the player send the UID of the action to the Control Track handler (codec). The fact that it can also be a key means that even for audio only files, a keyboard shortcut or button panel could be used for menues. But in that case, the hotspot will have to be associated with a name to display.
So this hightlight is sent from the Control Track to the Player. Then the player has to handle that highlight until it's disactivated (see Playback features)
The hightlight contains a UID of the action, a displayable name (UTF-8), an associated key (list of keys to be defined, probably up/down/left/right/select), a screen position/range and an image to display. The image will be displayed either when the user place the mouse over the rectangle (or any other shape), or when an option of the screen is selected (not activated). There could be a second image used when the option is activated. And there could be a third image that can serve as background. This way you could have a still image (like in some DVDs) for the menu and behind that image blank video (small bitrate).
When a highlight is activated by the user, the player has to send the UID of the action to the Control Track. Then the Control Track codec will handle the action and possibly give new orders to the player.
The format used for storing images SHOULD be extensible. For the moment we'll use PNG and BMP, both with alpha channel.
All the following features will be sent from the Control Track to the Player :
All the actions will be writen in a normal Matroska track, with a timecode. A "Menu Frame" SHOULD be able to contain more that one action/highlight for a given timecode. (to be determined, EBML format structure)
Some players might not support the control track. That mean they will play the active/looped parts as part of the data. So I suggest putting the active/looped parts of a movie at the end of a movie. When a Menu-aware player encouter the default Control Track of a Matroska file, the first order SHOULD be to jump at the start of the active/looped part of the movie.
As a Matroska side project, the obvious choice for storing binary data is EBML.