cellar | S. Lhomme |
Internet-Draft | |
Intended status: Standards Track | M. Bunkus |
Expires: November 27, 2017 | |
D. Rice | |
May 26, 2017 |
Matroska
draft-lhomme-cellar-matroska-02
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 November 27, 2017.
Copyright (c) 2017 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.
Attacks on a Matroska Reader could include:
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.
Matroska from version 1 through 3 uses language codes that 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). The ISO 639-2 Language Elements are "Language Element", "TagLanguage Element", and "ChapLanguage Element".
Starting in Matroska version 4, either ISO 639-2 or BCP 47 MAY be used, although BCP 47 is RECOMMENDED. The BCP 47 Language Elements are "LanguageIETF Element", "TagLanguageIETF Element", and "ChapLanguageIETF Element". If a BCP 47 Language Element and an ISO 639-2 Language Element are used within the same Parent Element, then the ISO 639-2 Lanaguage Element MUST be ignored and precedence given to the BCP 47 Language Element.
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 |
A Matroska file is composed of one or many EBML Documents that use the Matroska Document Type. Each EBML Document MUST start with an EBML Header and then the Root Element, which is called Segment in Matroska. Matroska defines several Top Level Elements which MAY occur within the Segment.
As an example, a simple Matroska file consisting of a single EBML Document could be represented like this:
A more complex Matroska file consisting of an EBML Stream (consisting of two EBML Documents) could be represented like this:
The following diagram represents a simple Matroska file, comprised of an EBML Document with an EBML Header, a Segment Element (the Root Element), and all eight Matroska Top Level Elements. In the following diagrams of this section, horizontal spacing expresses a parent-child relationship between Matroska Elements (e.g. the Info Element is contained within the Segment Element) whereas vertical alignment represents the storage order within the file.
+-------------+ | EBML Header | +---------------------------+ | Segment | SeekHead | | |-------------| | | Info | | |-------------| | | Tracks | | |-------------| | | Chapters | | |-------------| | | Cluster | | |-------------| | | Cues | | |-------------| | | Attachments | | |-------------| | | Tags | +---------------------------+
The Matroska EBML Schema defines eight Top Level Elements: SeekHead, Info, Tracks, Chapters, Cluster, Cues, Attachments, and Tags.
The SeekHead Element (also known as MetaSeek) contains an index of where other Top Level Elements of the Segment are located in order to let the parser know where the other major parts of the file are. This element isn't technicaly REQUIRED, but without a SeekHead Element a Matroska Parser would have to search the entire file to find all of the other Top Level Elements. This is because Matroska has flexible ordering requirements; for instance, the Chapters Element could be stored after the Cluster Elements.
+--------------------------------+ | SeekHead | Seek | SeekID | | | |--------------| | | | SeekPosition | +--------------------------------+
Representation of a SeekHead Element.
The Info Element contains vital information for identifying the whole Segment. This includes the title for the Segment, a randomly generated unique identifier so that the file can be identified around the world, and if it is part of a series of Segments, the unique identifier(s) of any linked Segments.
+-------------------------+ | Info | SegmentUID | | |------------------| | | SegmentFilename | | |------------------| | | PrevUID | | |------------------| | | PrevFilename | | |------------------| | | NextUID | | |------------------| | | NextFilename | | |------------------| | | SegmentFamily | | |------------------| | | ChapterTranslate | | |------------------| | | TimecodeScale | | |------------------| | | Duration | | |------------------| | | DateUTC | | |------------------| | | Title | | |------------------| | | MuxingApp | | |------------------| | | WritingApp | |-------------------------|
Representation of a Info Element and its Child Elements.
The Tracks Elements tells us the technical details of what is in each track. For instance, is it a video, audio or subtitle track? What resolution is the video? What sample rate is the audio? The Tracks Elements can store the name, number, unique identifier, language, and type (audio, video, subtitles, etc) of each track. The Tracks Element also identifies what codec to use to decode the track and has the codec's private data for the track.
+------------------------------------+ | Tracks | TrackEntry | TrackNumber | | | |--------------| | | | TrackUID | | | |--------------| | | | TrackType | | | |--------------| | | | Name | | | |--------------| | | | Language | | | |--------------| | | | CodecID | | | |--------------| | | | CodecPrivate | | | |--------------| | | | CodecName | | | |----------------------------------+ | | | Video | FlagInterlaced | | | | |-------------------| | | | | FieldOrder | | | | |-------------------| | | | | StereoMode | | | | |-------------------| | | | | AlphaMode | | | | |-------------------| | | | | PixelWidth | | | | |-------------------| | | | | PixelHeight | | | | |-------------------| | | | | DisplayWidth | | | | |-------------------| | | | | DisplayHeight | | | | |-------------------| | | | | AspectRatioType | | | | |-------------------| | | | | Color | | | |----------------------------------| | | | Audio | SamplingFrequency | | | | |-------------------| | | | | Channels | | | | |-------------------| | | | | BitDepth | |--------------------------------------------------------|
Representation of the Tracks Element and a selection of its Descendant Elements.
The Chapters Element section lists all of the Chapters. Chapters are a way to set predefined points to jump to in video or audio.
+----------------------------------------------+ | Chatpers | EditionEntry | EditionUID | | | |--------------------| | | | EditionFlagHidden | | | |--------------------| | | | EditionFlagDefault | | | |--------------------| | | | EditionFlagOrdered | | | |----------------------------------------+ | | | ChapterAtom | ChapterUID | | | | |-------------------| | | | | ChapterStringUID | | | | |-------------------| | | | | ChapterTimeStart | | | | |-------------------| | | | | ChapterTimeEnd | | | | |-------------------| | | | | ChapterFlagHidden | | | | |----------------------------------+ | | | | ChapterDisplay | ChapString | | | | | |--------------| | | | | | ChapLanguage | +---------------------------------------------------------------------------------+
Representation of the Chapters Element and a selection of its Descendant Elements.
The Cluster Elements contain all of the video frames and audio for each track. In a given Matroska file, there are usually many Cluster Elements. The Clusters help to break up the SimpleBlock or BlockGroup Elements and help with seeking and error protection. It is RECOMMENDED the size of each individual Cluster Element be limited to store no more than 5 seconds or 5 megabytes. Every Cluster contains a timecode, usually the timecode that the first Block in the Cluster SHOULD be played back, but it doesn't have to be. Then there are one or more (usually many more) BlockGroups or SimpleBlocks in each Cluster. A BlockGroup can contain a Block of data, and any information relating directly to that Block.
+--------------------------+ | Cluster | Timecode | | |----------------| | | SilentTracks | | |----------------| | | Position | | |----------------| | | PrevSize | | |----------------| | | SimpleBlock | | |----------------| | | BlockGroup | | |----------------| | | EncryptedBlock | +--------------------------+
Representation of a Cluster Element and its immediate Child Elements.
Below is a representation of the Block structure.
Although the Timecode value is stored once per Cluster, another timecode is stored within the Block structure itself. The way this works is that the Timecode in the Cluster is relative to the entire Segment. It is usually the Timecode that the first Block in the Cluster needs to be played at. The Timecode in the Block itself is relative to the Timecode in the Cluster. For example, let's say that the Timecode in the Cluster is set to 10 seconds, and you have a Block in that Cluster that is supposed to be played 12 seconds into the clip; this means that the Timecode in the Block would be set to 2 seconds.
The ReferenceBlock in the BlockGroup, is used instead of the basic "P-frame"/"B-frame" description. Instead of simply saying that this Block depends on the Block directly before, or directly afterwards, we put the timecode of the needed Block. And because you can have as many ReferenceBlock Elements as you want for a Block, it allows for some extremely complex referencing.
The Cues Element is used to seek when playing back a file by providing a temporal index for each of the tracks. It is similar to the SeekHead Element, but this is used for seeking to a specific time when playing back the file. Without this it is possible to seek, but it is much more difficult because the player has to 'hunt and peck' through the file looking for the correct timecode. Cues contains CuePoint Elements which store the timecode (CueTime) and then a listing for the exact position in the file for each of the tracks for that timecode. The Cues are pretty flexible for what exactly you want to index. For instance, you can index every single timecode of every Block or index selectively. If you have a video file, it is RECOMMENDED to index at least the keyframes of the video track.
+-------------------------------------+ | Cues | CuePoint | CueTime | | | |-------------------| | | | CueTrackPositions | | |------------------------------| | | CuePoint | CueTime | | | |-------------------| | | | CueTrackPositions | +-------------------------------------+
Representation of a Cues Element and two levels of its Descendant Elements.
The Attachments Element is for attaching files to a Matroska file such as pictures, webpages, programs, or even the codec needed to play back the file.
+------------------------------------------------+ | Attachments | AttachedFile | FileDescription | | | |-------------------| | | | FileName | | | |-------------------| | | | FileMimeType | | | |-------------------| | | | FileData | | | |-------------------| | | | FileUID | | | |-------------------| | | | FileName | | | |-------------------| | | | FileReferral | | | |-------------------| | | | FileUsedStartTime | | | |-------------------| | | | FileUsedEndTime | +------------------------------------------------+
Representation of a Attachments Element.
The Tags Element contains metadata that describes the Segment and potentially its Tracks, Chapters, and Attachments. Each Track or Chapter that those tags applies to has its UID listed in the tags. The Tags contain all extra information about the file, script writer, singer, actors, directors, titles, edition, price, dates, genre, comments, etc. And it allows you to enter many of these (title, edition, comments, etc.) in different languages.
+-------------------------------------------+ | Tags | Tag | Targets | TargetTypeValue | | | | |------------------| | | | | TargetType | | | | |------------------| | | | | TagTrackUID | | | | |------------------| | | | | TagEditionUID | | | | |------------------| | | | | TagChapterUID | | | | |------------------| | | | | TagAttachmentUID | | | |------------------------------| | | | SimpleTag | TagName | | | | |------------------| | | | | TagLanguage | | | | |------------------| | | | | TagDefault | | | | |------------------| | | | | TagString | | | | |------------------| | | | | TagBinary | | | | |------------------| | | | | SimpleTag | +-------------------------------------------+
Representation of a Tags Element and three levels of its Children Elements. # Matroska Schema
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
maxOccurs: 1
type: master
unknownsizeallowed: 1
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 Segment Position of other Top-Level Elements.
name: Seek
path: 1*(\Segment\SeekHead\Seek)
id: 0x4DBB
minOccurs: 1
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
maxOccurs: 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
maxOccurs: 1
type: uinteger
minver: 1
documentation: The Segment Position of the Element.
name: Info
path: 1*(\Segment\Info)
id: 0x1549A966
minOccurs: 1
type: master
minver: 1
definition: Contains general information about the Segment.
name: SegmentUID
path: 0*1(\Segment\Info\SegmentUID)
id: 0x73A4
maxOccurs: 1
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
maxOccurs: 1
type: utf-8
minver: 1
definition: A filename corresponding to this Segment.
name: PrevUID
path: 0*1(\Segment\Info\PrevUID)
id: 0x3CB923
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
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
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
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
maxOccurs: 1
type: uinteger
minver: 1
documentation: The chapter codec
name: ChapterTranslateID
path: 1*1(\Segment\Info\ChapterTranslate\ChapterTranslateID)
id: 0x69A5
minOccurs: 1
maxOccurs: 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
maxOccurs: 1
range: not 0
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
type: utf-8
minver: 1
documentation: General name of the Segment.
name: MuxingApp
path: 1*1(\Segment\Info\MuxingApp)
id: 0x4D80
minOccurs: 1
maxOccurs: 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
maxOccurs: 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
type: master
unknownsizeallowed: 1
minver: 1
documentation: The Top-Level Element containing the (monolithic) Block structure.
name: Timecode
path: 1*1(\Segment\Cluster\Timecode)
id: 0xE7
minOccurs: 1
maxOccurs: 1
type: uinteger
minver: 1
documentation: Absolute timestamp of the cluster (based on TimecodeScale).
name: SilentTracks
path: 0*1(\Segment\Cluster\SilentTracks)
id: 0x5854
maxOccurs: 1
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
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
maxOccurs: 1
type: uinteger
minver: 1
documentation: The Segment 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
maxOccurs: 1
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
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
type: master
minver: 1
documentation: Basic container of information containing a single Block and information specific to that Block.
name: Block
path: 1*1(\Segment\Cluster\BlockGroup\Block)
id: 0xA1
minOccurs: 1
maxOccurs: 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
maxOccurs: 1
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
maxOccurs: 1
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
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
maxOccurs: 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
maxOccurs: 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
maxOccurs: 1
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
maxOccurs: 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
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
maxOccurs: 1
type: integer
minver: 0
maxver: 0
documentation: The Segment 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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
type: master
minver: 1
documentation: Contains slices description.
name: TimeSlice
path: 0*(\Segment\Cluster\BlockGroup\Slices\TimeSlice)
id: 0xE8
type: master
minver: 1
maxver: 1
documentation: Contains extra time information about the data contained in the Block. Being able to interpret this Element is not REQUIRED for playback.
name: LaceNumber
path: 0*1(\Segment\Cluster\BlockGroup\Slices\TimeSlice\LaceNumber)
id: 0xCC
maxOccurs: 1
default: 0
type: uinteger
minver: 1
maxver: 1
documentation: The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). Being able to interpret this Element is not REQUIRED for playback.
name: FrameNumber
path: 0*1(\Segment\Cluster\BlockGroup\Slices\TimeSlice\FrameNumber)
id: 0xCD
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
type: master
minver: 0
maxver: 0
documentation: DivX trick track extensions
name: ReferenceOffset
path: 1*1(\Segment\Cluster\BlockGroup\ReferenceFrame\ReferenceOffset)
id: 0xC9
minOccurs: 1
maxOccurs: 1
type: uinteger
minver: 0
maxver: 0
documentation: DivX trick track extensions
name: ReferenceTimeCode
path: 1*1(\Segment\Cluster\BlockGroup\ReferenceFrame\ReferenceTimeCode)
id: 0xCA
minOccurs: 1
maxOccurs: 1
type: uinteger
minver: 0
maxver: 0
documentation: DivX trick track extensions
name: EncryptedBlock
path: 0*(\Segment\Cluster\EncryptedBlock)
id: 0xAF
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
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
type: master
minver: 1
documentation: Describes a track with all Elements.
name: TrackNumber
path: 1*1(\Segment\Tracks\TrackEntry\TrackNumber)
id: 0xD7
minOccurs: 1
maxOccurs: 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
maxOccurs: 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
maxOccurs: 1
range: 1-254
type: uinteger
minver: 1
documentation: A set of track types coded on 8 bits.
name: FlagEnabled
path: 1*1(\Segment\Tracks\TrackEntry\FlagEnabled)
id: 0xB9
minOccurs: 1
maxOccurs: 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
maxOccurs: 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
maxOccurs: 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
maxOccurs: 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
maxOccurs: 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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
range: > 0x0p+0
default: 0x1p+0
type: float
minver: 1
maxver: 3
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
maxOccurs: 1
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
maxOccurs: 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
maxOccurs: 1
type: utf-8
minver: 1
documentation: A human-readable track name.
name: Language
path: 0*1(\Segment\Tracks\TrackEntry\Language)
id: 0x22B59C
maxOccurs: 1
default: eng
type: string
minver: 1
documentation: Specifies the language of the track in the Matroska languages form. This Element MUST be ignored if the LanguageIETF Element is used in the same TrackEntry.
name: LanguageIETF
path: 0*1(\Segment\Tracks\TrackEntry\LanguageIETF)
id: 0x22B59D
maxOccurs: 1
type: string
minver: 4
documentation: Specifies the language of the track according to BCP 47 and using the IANA Language Subtag Registry. If this Element is used, then any Language Elements used in the same TrackEntry MUST be ignored.
name: CodecID
path: 1*1(\Segment\Tracks\TrackEntry\CodecID)
id: 0x86
minOccurs: 1
maxOccurs: 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
maxOccurs: 1
type: binary
minver: 1
documentation: Private data only known to the codec.
name: CodecName
path: 0*1(\Segment\Tracks\TrackEntry\CodecName)
id: 0x258688
maxOccurs: 1
type: utf-8
minver: 1
documentation: A human-readable string specifying the codec.
name: AttachmentLink
path: 0*1(\Segment\Tracks\TrackEntry\AttachmentLink)
id: 0x7446
maxOccurs: 1
range: not 0
type: uinteger
minver: 1
maxver: 3
documentation: The UID of an attachment that is used by this codec.
name: CodecSettings
path: 0*1(\Segment\Tracks\TrackEntry\CodecSettings)
id: 0x3A9697
maxOccurs: 1
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
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
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
maxOccurs: 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
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
maxOccurs: 1
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
maxOccurs: 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
type: master
minver: 1
documentation: The track identification for the given Chapter Codec.
name: TrackTranslateEditionUID
path: 0*(\Segment\Tracks\TrackEntry\TrackTranslate\TrackTranslateEditionUID)
id: 0x66FC
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
maxOccurs: 1
type: uinteger
minver: 1
documentation: The chapter codec.
name: TrackTranslateTrackID
path: 1*1(\Segment\Tracks\TrackEntry\TrackTranslate\TrackTranslateTrackID)
id: 0x66A5
minOccurs: 1
maxOccurs: 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
maxOccurs: 1
type: master
minver: 1
documentation: Video settings.
name: FlagInterlaced
path: 1*1(\Segment\Tracks\TrackEntry\Video\FlagInterlaced)
id: 0x9A
minOccurs: 1
maxOccurs: 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.
name: FieldOrder
path: 1*1(\Segment\Tracks\TrackEntry\Video\FieldOrder)
id: 0x9D
minOccurs: 1
maxOccurs: 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.
name: StereoMode
path: 0*1(\Segment\Tracks\TrackEntry\Video\StereoMode)
id: 0x53B8
maxOccurs: 1
default: 0
type: uinteger
minver: 3
documentation: Stereo-3D video mode. There are some more details on 3D support in the Specification Notes.
name: AlphaMode
path: 0*1(\Segment\Tracks\TrackEntry\Video\AlphaMode)
id: 0x53C0
maxOccurs: 1
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
maxOccurs: 1
type: uinteger
maxver: 0
documentation: DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska.
name: PixelWidth
path: 1*1(\Segment\Tracks\TrackEntry\Video\PixelWidth)
id: 0xB0
minOccurs: 1
maxOccurs: 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
maxOccurs: 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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
default: 0
type: uinteger
minver: 1
documentation: How DisplayWidth & DisplayHeight are interpreted.
name: AspectRatioType
path: 0*1(\Segment\Tracks\TrackEntry\Video\AspectRatioType)
id: 0x54B3
maxOccurs: 1
default: 0
type: uinteger
minver: 1
documentation: Specify the possible modifications to the aspect ratio.
name: ColourSpace
path: 0*1(\Segment\Tracks\TrackEntry\Video\ColourSpace)
id: 0x2EB524
maxOccurs: 1
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
maxOccurs: 1
range: > 0x0p+0
type: float
minver: 0
maxver: 0
documentation: Gamma Value.
name: FrameRate
path: 0*1(\Segment\Tracks\TrackEntry\Video\FrameRate)
id: 0x2383E3
maxOccurs: 1
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
maxOccurs: 1
type: master
minver: 4
documentation: Settings describing the colour format.
name: MatrixCoefficients
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\MatrixCoefficients)
id: 0x55B1
maxOccurs: 1
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.
name: BitsPerChannel
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\BitsPerChannel)
id: 0x55B2
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
default: 0
type: uinteger
minver: 4
documentation: How chroma is subsampled horizontally.
name: ChromaSitingVert
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\ChromaSitingVert)
id: 0x55B8
maxOccurs: 1
default: 0
type: uinteger
minver: 4
documentation: How chroma is subsampled vertically.
name: Range
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\Range)
id: 0x55B9
maxOccurs: 1
default: 0
type: uinteger
minver: 4
documentation: Clipping of the color ranges.
name: TransferCharacteristics
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\TransferCharacteristics)
id: 0x55BA
maxOccurs: 1
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.
name: Primaries
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\Primaries)
id: 0x55BB
maxOccurs: 1
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.
name: MaxCLL
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\MaxCLL)
id: 0x55BC
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
type: master
minver: 4
documentation: SMPTE 2086 mastering data.
name: PrimaryRChromaticityX
path: 0*1(\Segment\Tracks\TrackEntry\Video\Colour\MasteringMetadata\PrimaryRChromaticityX)
id: 0x55D1
maxOccurs: 1
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\MasteringMetadata\PrimaryRChromaticityY)
id: 0x55D2
maxOccurs: 1
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\MasteringMetadata\PrimaryGChromaticityX)
id: 0x55D3
maxOccurs: 1
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\MasteringMetadata\PrimaryGChromaticityY)
id: 0x55D4
maxOccurs: 1
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\MasteringMetadata\PrimaryBChromaticityX)
id: 0x55D5
maxOccurs: 1
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\MasteringMetadata\PrimaryBChromaticityY)
id: 0x55D6
maxOccurs: 1
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\MasteringMetadata\WhitePointChromaticityX)
id: 0x55D7
maxOccurs: 1
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\MasteringMetadata\WhitePointChromaticityY)
id: 0x55D8
maxOccurs: 1
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\MasteringMetadata\LuminanceMax)
id: 0x55D9
maxOccurs: 1
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\MasteringMetadata\LuminanceMin)
id: 0x55DA
maxOccurs: 1
range: 0-999.9999
type: float
minver: 4
documentation: Mininum luminance. Represented in candelas per square meter (cd/m²).
name: Projection
path: 0*1(\Segment\Tracks\TrackEntry\Video\Projection)
id: 0x7670
maxOccurs: 1
type: master
minver: 4
documentation: Describes the video projection details. Used to render spherical and VR videos.
name: ProjectionType
path: 1*1(\Segment\Tracks\TrackEntry\Video\Projection\ProjectionType)
id: 0x7671
minOccurs: 1
maxOccurs: 1
range: 0-3
default: 0
type: uinteger
minver: 4
documentation: Describes the projection used for this video track.
name: ProjectionPrivate
path: 0*1(\Segment\Tracks\TrackEntry\Video\Projection\ProjectionPrivate)
id: 0x7672
maxOccurs: 1
type: binary
minver: 4
documentation: Private data that only applies to a specific projection.SemanticsIf ProjectionType equals 0 (Rectangular), then this element must not be present.If ProjectionType equals 1 (Equirectangular), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Equirectangular Projection Box ('equi').If ProjectionType equals 2 (Cubemap), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Cubemap Projection Box ('cbmp').If ProjectionType equals 3 (Mesh), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Mesh Projection Box ('mshp').Note: ISOBMFF box size and fourcc fields are not included in the binary data, but the FullBox version and flag fields are. This is to avoid redundant framing information while preserving versioning and semantics between the two container formats.
name: ProjectionPoseYaw
path: 1*1(\Segment\Tracks\TrackEntry\Video\Projection\ProjectionPoseYaw)
id: 0x7673
minOccurs: 1
maxOccurs: 1
default: 0x0p+0
type: float
minver: 4
documentation: Specifies a yaw rotation to the projection.SemanticsValue represents a clockwise rotation, in degrees, around the up vector. This rotation must be applied before any ProjectionPosePitch or ProjectionPoseRoll rotations. The value of this field should be in the -180 to 180 degree range.
name: ProjectionPosePitch
path: 1*1(\Segment\Tracks\TrackEntry\Video\Projection\ProjectionPosePitch)
id: 0x7674
minOccurs: 1
maxOccurs: 1
default: 0x0p+0
type: float
minver: 4
documentation: Specifies a pitch rotation to the projection.SemanticsValue represents a counter-clockwise rotation, in degrees, around the right vector. This rotation must be applied after the ProjectionPoseYaw rotation and before the ProjectionPoseRoll rotation. The value of this field should be in the -90 to 90 degree range.
name: ProjectionPoseRoll
path: 1*1(\Segment\Tracks\TrackEntry\Video\Projection\ProjectionPoseRoll)
id: 0x7675
minOccurs: 1
maxOccurs: 1
default: 0x0p+0
type: float
minver: 4
documentation: Specifies a roll rotation to the projection.SemanticsValue represents a counter-clockwise rotation, in degrees, around the forward vector. This rotation must be applied after the ProjectionPoseYaw and ProjectionPosePitch rotations. The value of this field should be in the -180 to 180 degree range.
name: Audio
path: 0*1(\Segment\Tracks\TrackEntry\Audio)
id: 0xE1
maxOccurs: 1
type: master
minver: 1
documentation: Audio settings.
name: SamplingFrequency
path: 1*1(\Segment\Tracks\TrackEntry\Audio\SamplingFrequency)
id: 0xB5
minOccurs: 1
maxOccurs: 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
maxOccurs: 1
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
maxOccurs: 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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
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
maxOccurs: 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
maxOccurs: 1
type: uinteger
minver: 3
documentation: The kind of plane this track corresponds to.
name: TrackJoinBlocks
path: 0*1(\Segment\Tracks\TrackEntry\TrackOperation\TrackJoinBlocks)
id: 0xE9
maxOccurs: 1
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
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
maxOccurs: 1
type: uinteger
minver: 0
maxver: 0
documentation: DivX trick track extensions
name: TrickTrackSegmentUID
path: 0*1(\Segment\Tracks\TrackEntry\TrickTrackSegmentUID)
id: 0xC1
maxOccurs: 1
size: 16
type: binary
minver: 0
maxver: 0
documentation: DivX trick track extensions
name: TrickTrackFlag
path: 0*1(\Segment\Tracks\TrackEntry\TrickTrackFlag)
id: 0xC6
maxOccurs: 1
default: 0
type: uinteger
minver: 0
maxver: 0
documentation: DivX trick track extensions
name: TrickMasterTrackUID
path: 0*1(\Segment\Tracks\TrackEntry\TrickMasterTrackUID)
id: 0xC7
maxOccurs: 1
type: uinteger
minver: 0
maxver: 0
documentation: DivX trick track extensions
name: TrickMasterTrackSegmentUID
path: 0*1(\Segment\Tracks\TrackEntry\TrickMasterTrackSegmentUID)
id: 0xC4
maxOccurs: 1
size: 16
type: binary
minver: 0
maxver: 0
documentation: DivX trick track extensions
name: ContentEncodings
path: 0*1(\Segment\Tracks\TrackEntry\ContentEncodings)
id: 0x6D80
maxOccurs: 1
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
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
maxOccurs: 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
maxOccurs: 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
maxOccurs: 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
maxOccurs: 1
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
maxOccurs: 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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
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
maxOccurs: 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
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
maxOccurs: 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
maxOccurs: 1
type: uinteger
minver: 1
documentation: The Segment Position of the Cluster containing the associated Block.
name: CueRelativePosition
path: 0*1(\Segment\Cues\CuePoint\CueTrackPositions\CueRelativePosition)
id: 0xF0
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
default: 0
type: uinteger
minver: 2
documentation: The Segment 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
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
maxOccurs: 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
maxOccurs: 1
type: uinteger
minver: 0
maxver: 0
documentation: The Segment Position of the Cluster containing the referenced Block.
name: CueRefNumber
path: 0*1(\Segment\Cues\CuePoint\CueTrackPositions\CueReference\CueRefNumber)
id: 0x535F
maxOccurs: 1
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
maxOccurs: 1
default: 0
type: uinteger
minver: 0
maxver: 0
documentation: The Segment 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
maxOccurs: 1
type: master
minver: 1
documentation: Contain attached files.
name: AttachedFile
path: 1*(\Segment\Attachments\AttachedFile)
id: 0x61A7
minOccurs: 1
type: master
minver: 1
documentation: An attached file.
name: FileDescription
path: 0*1(\Segment\Attachments\AttachedFile\FileDescription)
id: 0x467E
maxOccurs: 1
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
maxOccurs: 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
maxOccurs: 1
type: string
minver: 1
documentation: MIME type of the file.
name: FileData
path: 1*1(\Segment\Attachments\AttachedFile\FileData)
id: 0x465C
minOccurs: 1
maxOccurs: 1
type: binary
minver: 1
documentation: The data of the file.
name: FileUID
path: 1*1(\Segment\Attachments\AttachedFile\FileUID)
id: 0x46AE
minOccurs: 1
maxOccurs: 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
maxOccurs: 1
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
maxOccurs: 1
type: uinteger
minver: 0
maxver: 0
documentation: DivX font extension
name: FileUsedEndTime
path: 0*1(\Segment\Attachments\AttachedFile\FileUsedEndTime)
id: 0x4662
maxOccurs: 1
type: uinteger
minver: 0
maxver: 0
documentation: DivX font extension
name: Chapters
path: 0*1(\Segment\Chapters)
id: 0x1043A770
maxOccurs: 1
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
type: master
minver: 1
documentation: Contains all information about a Segment edition.
name: EditionUID
path: 0*1(\Segment\Chapters\EditionEntry\EditionUID)
id: 0x45BC
maxOccurs: 1
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
maxOccurs: 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
maxOccurs: 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
maxOccurs: 1
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
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
maxOccurs: 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
maxOccurs: 1
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
maxOccurs: 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
maxOccurs: 1
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
maxOccurs: 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
maxOccurs: 1
range: 0-1
default: 1
type: uinteger
minver: 1
documentation: Specify whether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie SHOULD skip all the content between the TimeStart and TimeEnd of this chapter (see flag notes). (1 bit)
name: ChapterSegmentUID
path: 0*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterSegmentUID)
id: 0x6E67
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
maxOccurs: 1
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
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
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
maxOccurs: 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
default: eng
type: string
minver: 1
documentation: The languages corresponding to the string, in the bibliographic ISO-639-2 form. This Element MUST be ignored if the ChapLanguageIETF Element is used within the same ChapterDisplay Element.
name: ChapLanguageIETF
path: 0*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterDisplay\ChapLanguageIETF)
id: 0x437D
maxOccurs: 1
type: string
minver: 4
documentation: Specifies the language used in the ChapString according to BCP 47 and using the IANA Language Subtag Registry. If this Element is used, then any ChapLanguage Elements used in the same ChapterDisplay MUST be ignored.
name: ChapCountry
path: 0*(\Segment\Chapters\EditionEntry\ChapterAtom\ChapterDisplay\ChapCountry)
id: 0x437E
type: string
minver: 1
documentation: The countries corresponding to the string, same 2 octets as in Internet domains. This Element MUST be ignored if the ChapLanguageIETF Element is used within the same ChapterDisplay Element.
name: ChapProcess
path: 0*(\Segment\Chapters\EditionEntry\ChapterAtom\ChapProcess)
id: 0x6944
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
maxOccurs: 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
maxOccurs: 1
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
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
maxOccurs: 1
type: uinteger
minver: 1
documentation: Defines when the process command SHOULD be handled
name: ChapProcessData
path: 1*1(\Segment\Chapters\EditionEntry\ChapterAtom\ChapProcess\ChapProcessCommand\ChapProcessData)
id: 0x6933
minOccurs: 1
maxOccurs: 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
type: master
minver: 1
documentation: Element containing metadata describing Tracks, Editions, Chapters, Attachments, or the Segment as a whole. A list of valid tags can be found here.
name: Tag
path: 1*(\Segment\Tags\Tag)
id: 0x7373
minOccurs: 1
type: master
minver: 1
documentation: A single metadata descriptor.
name: Targets
path: 1*1(\Segment\Tags\Tag\Targets)
id: 0x63C0
minOccurs: 1
maxOccurs: 1
type: master
minver: 1
documentation: Specifies which other elements the metadata represented by the Tag applies to. If empty or not present, then the Tag describes everything in the Segment.
name: TargetTypeValue
path: 0*1(\Segment\Tags\Tag\Targets\TargetTypeValue)
id: 0x68CA
maxOccurs: 1
default: 50
type: uinteger
minver: 1
documentation: A number to indicate the logical level of the target.
name: TargetType
path: 0*1(\Segment\Tags\Tag\Targets\TargetType)
id: 0x63CA
maxOccurs: 1
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
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
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
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
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
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
maxOccurs: 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
maxOccurs: 1
default: und
type: string
minver: 1
documentation: Specifies the language of the tag specified, in the Matroska languages form. This Element MUST be ignored if the TagLanguageIETF Element is used within the same SimpleTag Element.
name: TagLanguageIETF
path: 0*1(\Segment\Tags\Tag\SimpleTag\TagLanguageIETF)
id: 0x447B
maxOccurs: 1
type: string
minver: 4
documentation: Specifies the language used in the TagString according to BCP 47 and using the IANA Language Subtag Registry. If this Element is used, then any TagLanguage Elements used in the same SimpleTag MUST be ignored.
name: TagDefault
path: 1*1(\Segment\Tags\Tag\SimpleTag\TagDefault)
id: 0x4484
minOccurs: 1
maxOccurs: 1
range: 0-1
default: 1
type: uinteger
minver: 1
documentation: A boolean value to indicate if this is the default/original language to use for the given tag.
name: TagString
path: 0*1(\Segment\Tags\Tag\SimpleTag\TagString)
id: 0x4487
maxOccurs: 1
type: utf-8
minver: 1
documentation: The value of the Tag.
name: TagBinary
path: 0*1(\Segment\Tags\Tag\SimpleTag\TagBinary)
id: 0x4485
maxOccurs: 1
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 separate 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 support 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 Segment Position of an Element refers to the position of the first octet of the Element ID of that Element, measured in octets, from the beginning of the Element Data section of the containing Segment Element. In other words, the Segment Position of an Element is the distance in octets from the beginning of its containing Segment Element minus the size of the Element ID and Element Data Size of that Segment Element. The Segment Position of the first Child Element of the Segment Element is 0. An Element which is not stored within a Segment Element, such as the Elements of the EBML Header, do not have a Segment Position.
Elements that are defined to store a Segment Position MAY define reserved values to indicate a special meaning.
This table presents an example of Segment Position by showing a hexadecimal representation of a very small Matroska file with labels to show the offsets in octets. The file contains a Segment Element with an Element ID of 0x18538067 and a MuxingApp Element with an Element ID of 0x4D80.
0 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 0 |1A|45|DF|A3|8B|42|82|88|6D|61|74|72|6F|73|6B|61|18|53|80|67| 20 |93|15|49|A9|66|8E|4D|80|84|69|65|74|66|57|41|84|69|65|74|66|
In the above example, the Element ID of the Segment Element is stored at offset 16, the Element Data Size of the Segment Element is stored at offset 20, and the Element Data of the Segment Element is stored at offset 21.
The MuxingApp Element is stored at offset 26. Since the Segment Position of an Element is calculated by subtracting the position of the Element Data of the containing Segment Element from the position of that Element, the Segment Position of MuxingApp Element in the above example is 26 - 21 or 5.
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 inaccuracy 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 will 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 re-encode 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.
The StereoMode used to be part of Matroska v2 but it didn't meet the requirement for multiple tracks. There was also a bug in libmatroska prior to 0.9.0 that would save/read it as 0x53B9 instead of 0x53B8. Readers may support these legacy files by checking Matroska v2 or 0x53B9. The olders values were 0: mono, 1: right eye, 2: left eye, 3: both eyes.
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 Cluster Elements can provide some seeking advantages. If the Cues Element is present, then it SHOULD either be stored before the first Cluster Element or be referenced by a SeekHead Element.
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.
A Codec Mapping is a set of attributes to identify, name, and contextualise the format and characteristics of encoded data that can be contained within Matroska Clusters.
Each TrackEntry used within Matroska MUST reference a defined Codec Mapping using the Codec ID to identify and describe the format of the encoded data in its associated Clusters. This Codec ID is a unique registered identifier that represents the encoding stored within the Track. Certain encodings MAY also require some form of codec initialisation in order to provide its decoder with context and technical metadata.
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 Codec ID. If you feel we missed support for a very important codec, please tell us on our development mailing list (cellar at ietf.org).
Support for a codec is defined in Matroska with the following values.
Each codec supported for storage in Matroska MUST have a unique Codec ID. Each Codec ID MUST be prefixed with the string from the following table according to the associated type of the codec. All characters of a Codec ID Prefix MUST be capital letters (A-Z) except for the last character of a Codec ID Prefix which MUST be an underscore ("_").
Codec Type | Codec ID Prefix Video | "V_" Audio | "A_" Subtitle | "S_" Button | "B_"
Each Codec ID MUST include a Major Codec ID immediately following the Codec ID Prefix. A Major Codec ID MAY be followed by an OPTIONAL Codec ID Suffix to communicate a refinement of the Major Codec ID. If a Codec ID Suffix is used, then the Codec ID MUST include a forward slash ("/") as a separator between the Major Codec ID and the Codec ID Suffix. The Major Codec ID MUST be composed of only capital letters (A-Z) and numbers (0-9). The Codec ID Suffix MUST be composed of only capital letters (A-Z), numbers (0-9), underscore ("_"), and forward slash ("/").
The following table provides examples of valid Codec IDs and their components:
Codec ID Prefix | Major Codec ID | Separator | Codec ID Suffix | Codec ID A_ | AAC | / | MPEG2/LC/SBR | AAAC/MPEG2/LC/SBR V | V_MPEG4 | / | ISO/ASP | VMPEG4/ISO/ASP V | MPEG1 | | | V_MPEG1
Each encoding supported for storage in Matroska MUST have a Codec Name. The Codec Name provides a readable label for the encoding.
An optional description for the encoding. This value is only intended for human consumption.
Each encoding supported for storage in Matroska MUST have a defined Initialisation. The Initialisation MUST describe the storage of data necessary to initialise the decoder, which MUST be stored within the CodecPrivate Element. When the Initialisation is updated within a track then that updated Initialisation data MUST be written into the CodecState Element of the first Cluster to require it. If the encoding does not require any form of Initialisation then none MUST be used to define the Initialisation and the CodecPrivate Element SHOULD NOT be written and MUST be ignored. Data that is defined Initialisation to be stored in the CodecPrivate Element is known as Private Data.
Documentation of the associated normative and informative references for the codec is RECOMMENDED.
A timestamp, expressed in [RFC3339] that notes when support for the Codec Mapping within Matroska was deprecated. If a Codec Mapping is defined with a Deprecation Date, then it is RECOMMENDED that Matroska writers SHOULD NOT use the Codec Mapping after the Deprecation Date.
A Codec Mapping MAY only be defined with a Superseded By value, if it has an expressed Deprecation Date. If used, the Superseded By value MUST store the Codec ID of another Codec Mapping that has superseded the Codec Mapping.
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 ???
Initialisation: Private Data contains the VCM structure BITMAPINFOHEADER including the extra private bytes, as defined by Microsoft in <https://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx>.
Citation: <https://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx>
Codec ID: V_UNCOMPRESSED
Codec Name: Video, raw uncompressed video frames
Description: All details about the used colour specs and bit depth are to be put/read from the KaxCodecColourSpace elements.
Initialisation: none
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.
Initialisation: none
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.
Initialisation: none
Codec ID: V_MPEG4/ISO/AP
Codec Name: MPEG4 ISO advanced profile
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.
Initialisation: none
Codec ID: V_MPEG4/MS/V3
Codec Name: Microsoft (TM) MPEG4 V3
Description: Microsoft (TM) MPEG4 V3 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.
Initialisation: none
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 self-made implementations
Initialisation: none
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 self-made implementations
Initialisation: none
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.
Initialisation: The Private Data contains a real_video_props_t structure in Big Endian byte order as found in librmff.
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.
Initialisation: The Private Data contains a real_video_props_t structure in Big Endian byte order as found in librmff.
Codec ID: V_REAL/RV30
Codec Name: RealVideo 8
Description: Individual slices from the Real container are combined into a single frame.
Initialisation: The Private Data contains a real_video_props_t structure in Big Endian byte order as found in librmff.
Codec ID: V_REAL/RV40
Codec Name: rv40 : RealVideo 9
Description: Individual slices from the Real container are combined into a single frame.
Initialisation: The Private Data contains a real_video_props_t structure in Big Endian byte order as found in librmff.
Codec ID: V_QUICKTIME
Codec Name: Video taken from QuickTime(TM) files
Description: Several codecs as stored in QuickTime, e.g. Sorenson or Cinepak.
Initialisation: The Private Data 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
Initialisation: 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
Initialisation: The Private Data contains the fourcc as found in MP4 movies:
this page for more technical details on ProRes
Codec ID: V_VP8
Codec Name: VP8 Codec format
Description: VP8 is an open and royalty free video compression format developed by Google and created by On2 Technologies as a successor to VP7. [RFC6386]
Initialisation: none
Codec ID: V_VP9
Codec Name: VP9 Codec format
Description: VP9 is an open and royalty free video compression format developed by Google as a successor to VP8. Draft VP9 Bitstream and Decoding Process Specification
Initialisation: none
Codec ID: V_FFV1
Codec Name: FF Video Codec 1
Description: FFV1 is a lossless intra-frame video encoding format designed to efficiently compress video data in a variety of pixel formats. Compared to uncompressed video, FFV1 offers storage compression, frame fixity, and self-description, which makes FFV1 useful as a preservation or intermediate video format. Draft FFV1 Specification
Initialisation: For FFV1 versions 0 or 1, Private Data SHOULD NOT be written. For FFV1 version 3 or greater, the Private Data MUST contain the FFV1 Configuration Record structure, as defined in <https://tools.ietf.org/html/draft-niedermayer-cellar-ffv1-01#section-4.1>, and no other data.
Codec ID: A_MPEG/L3
Codec Name: MPEG Audio 1, 2, 2.5 Layer III
Description: The data contain everything needed for playback in the MPEG Audio header of each frame. Corresponding ACM wFormatTag : 0x0055
Initialisation: none
Codec ID: A_MPEG/L2
Codec Name: MPEG Audio 1, 2 Layer II
Description: The data contain everything needed for playback in the MPEG Audio header of each frame. Corresponding ACM wFormatTag : 0x0050
Initialisation: none
Codec ID: A_MPEG/L1
Codec Name: MPEG Audio 1, 2 Layer I
Description: The data contain everything needed for playback in the MPEG Audio header of each frame. Corresponding ACM wFormatTag : 0x0050
Initialisation: none
Codec ID: A_PCM/INT/BIG
Codec Name: PCM Integer Big Endian
Description: The bitdepth has to be read and set from KaxAudioBitDepth element. Corresponding ACM wFormatTag : ???
Initialisation: none
Codec ID: A_PCM/INT/LIT
Codec Name: PCM Integer Little Endian
Description: The bitdepth has to be read and set from KaxAudioBitDepth element. Corresponding ACM wFormatTag : 0x0001
Initialisation: none
Codec ID: A_PCM/FLOAT/IEEE
Codec Name: Floating Point, IEEE compatible
Description: 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
Initialisation: none
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 defined 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
Initialisation: none
Codec ID: A_AC3/BSID10
Codec Name: (Dolby™) AC3
Description: The ac3 frame header has, similar to the mpeg-audio header a version field. Normal ac3 is defined 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
Initialisation: none
Codec ID: A_ALAC
Codec Name: ALAC (Apple Lossless Audio Codec)
Initialisation: 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
Initialisation: none
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
Initialisation: none
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
Initialisation: none
Codec ID: A_VORBIS
Codec Name: Vorbis
Initialisation: 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)
Initialisation: 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/14_4
Codec Name: Real Audio 1
Initialisation: The Private Data 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/28_8
Codec Name: Real Audio 2
Initialisation: The Private Data 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/COOK
Codec Name: Real Audio Cook Codec (codename: Gecko)
Initialisation: The Private Data 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/SIPR
Codec Name: Sipro Voice Codec
Initialisation: The Private Data 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/RALF
Codec Name: Real Audio Lossless Format
Initialisation: The Private Data 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/ATRC
Codec Name: Sony Atrac3 Codec
Initialisation: The Private Data 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_MS/ACM
Codec Name: Microsoft(TM) Audio Codec Manager (ACM)
Description: The data are stored in little endian format (like on IA32 machines).
Initialisation: The Private Data contains the ACM structure WAVEFORMATEX including the extra private bytes, as defined by Microsoft.
Codec ID: A_AAC/MPEG2/MAIN
Codec Name: MPEG2 Main Profile
Description: 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. AAC audio always uses wFormatTag 0xFF.
Initialisation: none
Codec ID: A_AAC/MPEG2/LC
Codec Name: Low Complexity
Description: 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. AAC audio always uses wFormatTag 0xFF.
Initialisation: none
Codec ID: A_AAC/MPEG2/LC/SBR
Codec Name: Low Complexity with Spectral Band Replication
Description: 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. AAC audio always uses wFormatTag 0xFF.
Initialisation: none
Codec ID: A_AAC/MPEG2/SSR
Codec Name: Scalable Sampling Rate
Description: 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. AAC audio always uses wFormatTag 0xFF.
Initialisation: none
Codec ID: A_AAC/MPEG4/MAIN
Codec Name: MPEG4 Main Profile
Description: 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. AAC audio always uses wFormatTag 0xFF.
Initialisation: none
Codec ID: A_AAC/MPEG4/LC
Codec Name: Low Complexity
Description: 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. AAC audio always uses wFormatTag 0xFF.
Initialisation: none
Codec ID: A_AAC/MPEG4/LC/SBR
Codec Name: Low Complexity with Spectral Band Replication
Description: 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. AAC audio always uses wFormatTag 0xFF.
Initialisation: none
Codec ID: A_AAC/MPEG4/SSR
Codec Name: Scalable Sampling Rate
Description: 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. AAC audio always uses wFormatTag 0xFF.
Initialisation: none
Codec ID: A_AAC/MPEG4/LTP
Codec Name: Long Term Prediction
Description: 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. AAC audio always uses wFormatTag 0xFF.
Initialisation: none
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.
Initialisation: The Private Data 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/QDMC
Codec Name: QDesign Music
Description:
Initialisation: The Private Data 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.
Superseded By: A_QUICKTIME
Codec ID: A_QUICKTIME/QDM2
Codec Name: QDesign Music v2
Description:
Initialisation: The Private Data 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.
Superseded By: A_QUICKTIME
Codec ID: A_TTA1
Codec Name: The True Audio lossless audio compressor
Description: TTA format description Each frame is kept intact, including the CRC32. The header and seektable are dropped. SamplingFrequency, Channels and BitDepth are used in the TrackEntry. wFormatTag = 0x77A1
Initialisation: none
Codec ID: A_WAVPACK4
Codec Name: WavPack lossless 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.
Initialisation: none
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_DVBSUB
Codec Name: Digital Video Broadcasting (DVB) subtitles
Description: This is the graphical subtitle format used in the Digital Video Broadcasting standard. For more information about the storage please look at the Digital Video Broadcasting (DVB) subtitles in Matroska specifications.
Codec ID: S_VOBSUB
Codec Name: VobSub subtitles
Description: The same subtitle format used on DVDs. Supported 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_HDMV/PGS
Codec Name: HDMV presentation graphics subtitles (PGS)
Description: This is the graphical subtitle format used on Blu-rays. For more information about the storage please look at the HDMV presentation graphics subtitles in Matroska specifications.
Codec ID: S_HDMV/TEXTST
Codec Name: HDMV text subtitles
Description: This is the textual subtitle format used on Blu-rays. For more information about the storage please look at the HDMV text subtitles in Matroska specifications.
Codec ID: S_KATE
Codec Name: Karaoke And Text Encapsulation
Description: A subtitle format developed 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
Two Chapter Flags are defined to describe the bevahior of the ChapterAtom Element: ChapterFlagHidden and ChapterFlagEnabled.
If a ChapterAtom Element is a Child Element of another ChapterAtom Element which has a Chapter Flag set to true, then the Child ChapterAtom Element MUST be interpretted as having its same Chapter Flag set to true. If a ChapterAtom Element is a Child Element of another ChapterAtom Element which has a Chapter Flag set to false or the ChapterAtom Element does not have a ChapterAtom Element as its Parent Element, then it MUST be interpretted according to its own Chapter Flag.
As an example, consider a Parent ChapterAtom Element that has its ChapterFlagHidden set to true and also contains two child ChapterAtoms, the first with ChapterFlagHidden set to true and the second with ChapterFlagHidden either set to false or not present at all (in which case the default value of the Element applies, which is false). Since the parent ChapterAtom has its ChapterFlagHidden set to true then all of its children ChapterAtoms MUST also be interpretted as if their ChapterFlagHidden is also set to true. However, if a Control Track toggles the parent's ChapterFlagHidden flag to false, then only the parent ChapterAtom and its second child ChapterAtom MUST be interpretted as if ChapterFlagHidden is set to false. The first child ChapterAtom which has the ChapterFlagHidden flag set to true retains its value until its value is toggled to false by a Control Track.
Three Edition Flags are defined to describe the bevahior of the EditionEntry Element: EditionFlagHidden, EditionFlagDefault and EditionFlagOrdered.
The EditionFlagHidden Flag behaves similarly to the ChapterFlagHidden Flag: if EditionFlagHidden is set to true then its Child ChapterAtoms Elements MUST also be interpretted as if their ChapterFlagHidden is also set to true, regardless of their own ChapterFlagHidden flags. If the EditionFlagHidden is toggled by a Control Track to false then the ChapterFlagHidden Flags of the Child ChapterAtoms Elements SHALL determine if the ChapterAtom is hidden or not.
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.
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> <EditionUID>16603393396715046047</EditionUID> <ChapterAtom> <ChapterUID>1193046</ChapterUID> <ChapterTimeStart>0</ChapterTimeStart> <ChapterTimeEnd>5000000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Intro</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>2311527</ChapterUID> <ChapterTimeStart>5000000000</ChapterTimeStart> <ChapterTimeEnd>25000000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Before the crime</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterDisplay> <ChapString>Avant le crime</ChapString> <ChapLanguage>fra</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>3430008</ChapterUID> <ChapterTimeStart>25000000000</ChapterTimeStart> <ChapterTimeEnd>27500000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>The crime</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterDisplay> <ChapString>Le crime</ChapString> <ChapLanguage>fra</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>4548489</ChapterUID> <ChapterTimeStart>27500000000</ChapterTimeStart> <ChapterTimeEnd>38000000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>After the crime</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterDisplay> <ChapString>Après le crime</ChapString> <ChapLanguage>fra</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>5666960</ChapterUID> <ChapterTimeStart>38000000000</ChapterTimeStart> <ChapterTimeEnd>43000000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Credits</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterDisplay> <ChapString>Générique</ChapString> <ChapLanguage>fra</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <EditionFlagDefault>0</EditionFlagDefault> <EditionFlagHidden>0</EditionFlagHidden> </EditionEntry> </Chapters>
In this example an (existing) album is split into different chapters, and one of them contain another splitting.
<Chapters> <EditionEntry> <EditionUID>1281690858003401414</EditionUID> <ChapterAtom> <ChapterUID>1</ChapterUID> <ChapterTimeStart>0</ChapterTimeStart> <ChapterTimeEnd>748000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to Bleep/Rock</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterAtom> <ChapterUID>2</ChapterUID> <ChapterTimeStart>0</ChapterTimeStart> <ChapterTimeEnd>278000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to bleep (pt.1)</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>3</ChapterUID> <ChapterTimeStart>278000000</ChapterTimeStart> <ChapterTimeEnd>432000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to rock</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>4</ChapterUID> <ChapterTimeStart>432000000</ChapterTimeStart> <ChapterTimeEnd>633000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to bleep (pt.2)</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>5</ChapterUID> <ChapterTimeStart>633000000</ChapterTimeStart> <ChapterTimeEnd>748000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to bleep (pt.3)</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>6</ChapterUID> <ChapterTimeStart>750000000</ChapterTimeStart> <ChapterTimeEnd>1178500000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Bleeper_O+2</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>7</ChapterUID> <ChapterTimeStart>1180500000</ChapterTimeStart> <ChapterTimeEnd>1340000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to bleep (pt.4)</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>8</ChapterUID> <ChapterTimeStart>1342000000</ChapterTimeStart> <ChapterTimeEnd>1518000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Bleep to bleep</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>9</ChapterUID> <ChapterTimeStart>1520000000</ChapterTimeStart> <ChapterTimeEnd>2015000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Baby wants to bleep (k)</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <ChapterAtom> <ChapterUID>10</ChapterUID> <ChapterTimeStart>2017000000</ChapterTimeStart> <ChapterTimeEnd>2668000000</ChapterTimeEnd> <ChapterDisplay> <ChapString>Bleeper</ChapString> <ChapLanguage>eng</ChapLanguage> </ChapterDisplay> <ChapterFlagHidden>0</ChapterFlagHidden> <ChapterFlagEnabled>1</ChapterFlagEnabled> </ChapterAtom> <EditionFlagDefault>0</EditionFlagDefault> <EditionFlagHidden>0</EditionFlagHidden> </EditionEntry> </Chapters>
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/](http://www.eswat.demon.co.uk/) ; or email [kotus@eswat.demon.co.uk](mailto:kotus@eswat.demon.co.uk) Title: Wolf's rain 2 Original Script: Anime-spirit Ishin-francais Original Translation: Coolman Original Editing: Spikewolfwood Original Timing: Lord_alucard 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_-_02_Wav.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/](http://www.eswat.demon.co.uk/) ; or email [kotus@eswat.demon.co.uk](mailto:kotus@eswat.demon.co.uk) Title: Wolf's rain 2 Original Script: Anime-spirit Ishin-francais Original Translation: Coolman Original Editing: Spikewolfwood Original Timing: Lord_alucard 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_-_02_Wav.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:
WEBVTT with text after the signature STYLE ::cue { background-image: linear-gradient(to bottom, dimgray, lightgray); color: papayawhip; } /* Style blocks cannot use blank lines nor "dash dash greater than" */ NOTE comment blocks can be used between style blocks. STYLE ::cue(b) { color: peachpuff; } REGION id:bill width:40% lines:3 regionanchor:0%,100% viewportanchor:10%,90% scroll:up NOTE Notes always span a whole block and can cover multiple lines. Like this one. An empty line ends the block. hello 00:00:00.000 --> 00:00:10.000 Example entry 1: Hello <b>world</b>. NOTE style blocks cannot appear after the first cue. 00:00:25.000 --> 00:00:35.000 Example entry 2: Another entry. This one has multiple lines. 00:01:03.000 --> 00:01:06.500 position:90% align:right size:35% Example entry 3: That stuff to the right of the timestamps are cue settings. 00:03:10.000 --> 00:03:20.000 Example entry 4: Entries can even include timestamps. For example:<00:03:15.000>This becomes visible five seconds after the first part.
The resulting CodecPrivate element will look like this:
WEBVTT with text after the signature STYLE ::cue { background-image: linear-gradient(to bottom, dimgray, lightgray); color: papayawhip; } /* Style blocks cannot use blank lines nor "dash dash greater than" */ NOTE comment blocks can be used between style blocks. STYLE ::cue(b) { color: peachpuff; } REGION id:bill width:40% lines:3 regionanchor:0%,100% viewportanchor:10%,90% scroll:up NOTE Notes always span a whole block and can cover multiple lines. Like this one. An empty line ends the block.
Example Cue 1: timestamp 00:00:00.000, duration 00:00:10.000, Block's content:
Example entry 1: Hello <b>world</b>.
BlockAddition's content starts with one empty line as there's no Cue Settings List:
hello
Example Cue 2: timestamp 00:00:25.000, duration 00:00:10.000, Block's content:
Example entry 2: Another entry. This one has multiple lines.
BlockAddition's content starts with two empty lines as there's neither a Cue Settings List nor a Cue Identifier:
NOTE style blocks cannot appear after the first cue.
Example Cue 3: timestamp 00:01:03.000, duration 00:00:03.500, Block's content:
Example entry 3: That stuff to the right of the timestamps are cue settings.
BlockAddition's content ends with an empty line as there's no Cue Identifier and there were no WebVTT Comment blocks:
position:90% align:right size:35%
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.
The specifications for the HDMV presentation graphics subtitle format (short: HDMV PGS) can be found in the document "Blu-ray Disc Read-Only Format; Part 3 — Audio Visual Basic Specifications" in section 9.14 "HDMV graphics streams".
The CodecID to use is S_HDMV/PGS. A CodecPrivate element is not used.
Each HDMV PGS Segment (short: Segment) will be stored in a Matroska Block. A Segment is the data structure described in section 9.14.2.1 "Segment coding structure and parameters" of the Blu-ray specifications.
Each Segment contains a presentation timestamp. This timestamp will be used as the timestamp for the Matroska Block.
A Segment is normally shown until a subsequent Segment is encountered. Therefore the Matroska Block MAY have no Duration. In that case a player MUST display a Segment within a Matroska Block until the next Segment is encountered.
A muxer MAY use a Duration, e.g. by calculating the distance between two subsequent Segments. If a Matroska Block has a Duration, a player MUST display that Segment only for the duration of the Block's Duration.
The specifications for the HDMV text subtitle format (short: HDMV TextST) can be found in the document "Blu-ray Disc Read-Only Format; Part 3 — Audio Visual Basic Specifications" in section 9.15 "HDMV text subtitle streams".
The CodecID to use is S_HDMV/TEXTST.
A CodecPrivate Element is required. It MUST contain the stream's Dialog Style Segment as described in section 9.15.4.2 "Dialog Style Segment" of the Blu-ray specifications.
Each HDMV Dialog Presentation Segment (short: Segment) will be stored in a Matroska Block. A Segment is the data structure described in section 9.15.4.3 "Dialog presentation segment" of the Blu-ray specifications.
Each Segment contains a start and an end presentation timestamp (short: start PTS & end PTS). The start PTS will be used as the timestamp for the Matroska Block. The Matroska Block MUST have a Duration, and that Duration is the difference between the end PTS and the start PTS.
A player MUST use the Matroska Block's timestamp and Duration instead of the Segment's start and end PTS for determining when and how long to show the Segment.
When TextST subtitles are stored inside Matroska, the only allowed character set is UTF-8.
Each HDMV text subtitle stream in a Blu-ray can use one of a handful of character sets. This information is not stored in the MPEG2 Transport Stream itself but in the accompanying Clip Information file.
Therefore a muxer MUST parse the accompanying Clip Information file. If the information indicates a character set other than UTF-8, it MUST re-encode all text Dialog Presentation Segments from the indicated character set to UTF-8 prior to storing them in Matroska.
The specifications for the Digital Video Broadcasting subtitle bitstream format (short: DVB subtitles) can be found in the document "ETSI EN 300 743 - Digital Video Broadcasting (DVB); Subtitling systems". The storage of DVB subtitles in MPEG transport streams is specified in the document "ETSI EN 300 468 - Digital Video Broadcasting (DVB); Specification for Service Information (SI) in DVB systems".
The CodecID to use is S_DVBSUB.
The CodecPrivate element is five bytes long and has the following structure:
The semantics of these bytes are the same as the ones described in section 6.2.41 "Subtitling descriptor" of ETSI EN 300 468.
Each Matroska Block consists of one or more DVB Subtitle Segments as described in segment 7.2 "Syntax and semantics of the subtitling segment" of ETSI EN 300 743.
Each Matroska Block SHOULD have a Duration indicating how long the DVB Subtitle Segments in that Block SHOULD be displayed.
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:
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 developers 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).
TargetTypeValue | Audio strings | Video strings | Comment 70 | COLLECTION | COLLECTION | the high hierarchy consisting of many different lower items 60 | EDITION / ISSUE / VOLUME / OPUS | SEASON / SEQUEL / VOLUME | a list of lower levels grouped together 50 | ALBUM / OPERA / CONCERT | MOVIE / EPISODE / CONCERT | the most common grouping level of music and video (equals to an episode for TV series) 40 | PART / SESSION | PART / SESSION | when an album or episode has different logical parts 30 | TRACK / SONG | CHAPTER | the common parts of an album or a movie 20 | SUBTRACK / PART / MOVEMENT | SCENE | corresponds to parts of a track for audio (like a movement) 10 | - | SHOT | the lowest hierarchy found in music or movies
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 recommended as compatibility 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.
Nesting Information tags are intended to contain other tags.
Tag Name | Type | Description |
---|---|---|
ORIGINAL | - | A special tag that is meant to have other tags inside (using nested tags) to describe the original work of art that this item is based on. All tags in this list can be used "under" the ORIGINAL tag like LYRICIST, PERFORMER, etc. |
SAMPLE | - | A tag that contains other tags to describe a sample used in the targeted item taken from another work of art. All tags in this list can be used "under" the SAMPLE tag like TITLE, ARTIST, DATE_RELEASED, etc. |
COUNTRY | UTF-8 | The name of the country (biblio ISO-639-2) that is meant to have other tags inside (using nested tags) to country specific information about the item. All tags in this list can be used "under" the COUNTRY_SPECIFIC tag like LABEL, PUBLISH_RATING, etc. |
Tag Name | Type | Description |
---|---|---|
TOTAL_PARTS | UTF-8 | Total number of parts defined at the first lower level. (e.g. if TargetType is ALBUM, the total number of tracks of an audio CD) |
PART_NUMBER | UTF-8 | Number of the current part of the current level. (e.g. if TargetType is TRACK, the track number of an audio CD) |
PART_OFFSET | UTF-8 | A number to add to PART_NUMBER when the parts at that level don't start at 1. (e.g. if TargetType is TRACK, the track number of the second audio CD) |
Tag Name | Type | Description |
---|---|---|
TITLE | UTF-8 | The title of this item. For example, for music you might label this "Canon in D", or for video's audio track you might use "English 5.1" This is akin to the TIT2 tag in ID3. |
SUBTITLE | UTF-8 | Sub Title of the entity. |
Nested Information includes tags contained in other tags.
Tag Name | Type | Description |
---|---|---|
URL | UTF-8 | URL corresponding to the tag it's included in. |
SORT_WITH | UTF-8 | A child element to indicate what alternative value the parent tag can have to be sorted, for example "Pet Shop Boys" instead of "The Pet Shop Boys". Or "Marley Bob" and "Marley Ziggy" (no comma needed). |
INSTRUMENTS | UTF-8 | The instruments that are being used/played, separated by a comma. It SHOULD be a child of the following tags: ARTIST, LEAD_PERFORMER or ACCOMPANIMENT. |
UTF-8 | Email corresponding to the tag it's included in. | |
ADDRESS | UTF-8 | The physical address of the entity. The address SHOULD include a country code. It can be useful for a recording label. |
FAX | UTF-8 | The fax number corresponding to the tag it's included in. It can be useful for a recording label. |
PHONE | UTF-8 | The phone number corresponding to the tag it's included in. It can be useful for a recording label. |
Tag Name | Type | Description |
---|---|---|
ARTIST | UTF-8 | A person or band/collective generally considered responsible for the work. This is akin to the TPE1 tag in ID3. |
LEAD_PERFORMER | UTF-8 | Lead Performer/Soloist(s). This can sometimes be the same as ARTIST. |
ACCOMPANIMENT | UTF-8 | Band/orchestra/accompaniment/musician. This is akin to the TPE2 tag in ID3. |
COMPOSER | UTF-8 | The name of the composer of this item. This is akin to the TCOM tag in ID3. |
ARRANGER | UTF-8 | The person who arranged the piece, e.g., Ravel. |
LYRICS | UTF-8 | The lyrics corresponding to a song (in case audio synchronization is not known or as a doublon to a subtitle track). Editing this value when subtitles are found SHOULD also result in editing the subtitle track for more consistency. |
LYRICIST | UTF-8 | The person who wrote the lyrics for a musical item. This is akin to the TEXT tag in ID3. |
CONDUCTOR | UTF-8 | Conductor/performer refinement. This is akin to the TPE3. |
DIRECTOR | UTF-8 | This is akin to the IART tag in RIFF. |
ASSISTANT_DIRECTOR | UTF-8 | The name of the assistant director. |
DIRECTOR_OF_PHOTOGRAPHY | UTF-8 | The name of the director of photography, also known as cinematographer. This is akin to the ICNM tag in Extended RIFF. |
SOUND_ENGINEER | UTF-8 | The name of the sound engineer or sound recordist. |
ART_DIRECTOR | UTF-8 | The person who oversees the artists and craftspeople who build the sets. |
PRODUCTION_DESIGNER | UTF-8 | Artist responsible for designing the overall visual appearance of a movie. |
CHOREGRAPHER | UTF-8 | The name of the choregrapher |
COSTUME_DESIGNER | UTF-8 | The name of the costume designer |
ACTOR | UTF-8 | An actor or actress playing a role in this movie. This is the person's real name, not the character's name the person is playing. |
CHARACTER | UTF-8 | The name of the character an actor or actress plays in this movie. This SHOULD be a sub-tag of an ACTOR tag in order not to cause ambiguities. |
WRITTEN_BY | UTF-8 | The author of the story or script (used for movies and TV shows). |
SCREENPLAY_BY | UTF-8 | The author of the screenplay or scenario (used for movies and TV shows). |
EDITED_BY | UTF-8 | This is akin to the IEDT tag in Extended RIFF. |
PRODUCER | UTF-8 | Produced by. This is akin to the IPRO tag in Extended RIFF. |
COPRODUCER | UTF-8 | The name of a co-producer. |
EXECUTIVE_PRODUCER | UTF-8 | The name of an executive producer. |
DISTRIBUTED_BY | UTF-8 | This is akin to the IDST tag in Extended RIFF. |
MASTERED_BY | UTF-8 | The engineer who mastered the content for a physical medium or for digital distribution. |
ENCODED_BY | UTF-8 | This is akin to the TENC tag in ID3. |
MIXED_BY | UTF-8 | DJ mix by the artist specified |
REMIXED_BY | UTF-8 | Interpreted, remixed, or otherwise modified by. This is akin to the TPE4 tag in ID3. |
PRODUCTION_STUDIO | UTF-8 | This is akin to the ISTD tag in Extended RIFF. |
THANKS_TO | UTF-8 | A very general tag for everyone else that wants to be listed. |
PUBLISHER | UTF-8 | This is akin to the TPUB tag in ID3. |
LABEL | UTF-8 | The record label or imprint on the disc. |
Tag Name | Type | Description |
---|---|---|
GENRE | UTF-8 | The main genre (classical, ambient-house, synthpop, sci-fi, drama, etc). The format follows the infamous TCON tag in ID3. |
MOOD | UTF-8 | Intended to reflect the mood of the item with a few keywords, e.g. "Romantic", "Sad" or "Uplifting". The format follows that of the TMOO tag in ID3. |
ORIGINAL_MEDIA_TYPE | UTF-8 | Describes the original type of the media, such as, "DVD", "CD", "computer image," "drawing," "lithograph," and so forth. This is akin to the TMED tag in ID3. |
CONTENT_TYPE | UTF-8 | The type of the item. e.g. Documentary, Feature Film, Cartoon, Music Video, Music, Sound FX, ... |
SUBJECT | UTF-8 | Describes the topic of the file, such as "Aerial view of Seattle." |
DESCRIPTION | UTF-8 | A short description of the content, such as "Two birds flying." |
KEYWORDS | UTF-8 | Keywords to the item separated by a comma, used for searching. |
SUMMARY | UTF-8 | A plot outline or a summary of the story. |
SYNOPSIS | UTF-8 | A description of the story line of the item. |
INITIAL_KEY | UTF-8 | The initial key that a musical track starts in. The format is identical to ID3. |
PERIOD | UTF-8 | Describes the period that the piece is from or about. For example, "Renaissance". |
LAW_RATING | UTF-8 | Depending on the COUNTRY it's the format of the rating of a movie (P, R, X in the USA, an age in other countries or a URI defining a logo). |
ICRA | binary | The ICRA content rating for parental control. (Previously RSACi) |
Tag Name | Type | Description |
---|---|---|
DATE_RELEASED | UTF-8 | The time that the item was originally released. This is akin to the TDRL tag in ID3. |
DATE_RECORDED | UTF-8 | The time that the recording began. This is akin to the TDRC tag in ID3. |
DATE_ENCODED | UTF-8 | The time that the encoding of this item was completed began. This is akin to the TDEN tag in ID3. |
DATE_TAGGED | UTF-8 | The time that the tags were done for this item. This is akin to the TDTG tag in ID3. |
DATE_DIGITIZED | UTF-8 | The time that the item was transferred to a digital medium. This is akin to the IDIT tag in RIFF. |
DATE_WRITTEN | UTF-8 | The time that the writing of the music/script began. |
DATE_PURCHASED | UTF-8 | Information on when the file was purchased (see also Section 41.17). |
Tag Name | Type | Description |
---|---|---|
RECORDING_LOCATION | UTF-8 | The location where the item was recorded. The countries corresponding to the string, same 2 octets as in Internet domains, or possibly ISO-3166. This code is followed by a comma, then more detailed information such as state/province, another comma, and then city. For example, "US, Texas, Austin". This will allow for easy sorting. It is okay to only store the country, or the country and the state/province. More detailed information can be added after the city through the use of additional commas. In cases where the province/state is unknown, but you want to store the city, simply leave a space between the two commas. For example, "US, , Austin". |
COMPOSITION_LOCATION | UTF-8 | Location that the item was originally designed/written. The countries corresponding to the string, same 2 octets as in Internet domains, or possibly ISO-3166. This code is followed by a comma, then more detailed information such as state/province, another comma, and then city. For example, "US, Texas, Austin". This will allow for easy sorting. It is okay to only store the country, or the country and the state/province. More detailed information can be added after the city through the use of additional commas. In cases where the province/state is unknown, but you want to store the city, simply leave a space between the two commas. For example, "US, , Austin". |
COMPOSER_NATIONALITY | UTF-8 | Nationality of the main composer of the item, mostly for classical music. The countries corresponding to the string, same 2 octets as in Internet domains, or possibly ISO-3166. |
Tag Name | Type | Description |
---|---|---|
COMMENT | UTF-8 | Any comment related to the content. |
PLAY_COUNTER | UTF-8 | The number of time the item has been played. |
RATING | UTF-8 | A numeric value defining how much a person likes the song/movie. The number is between 0 and 5 with decimal values possible (e.g. 2.7), 5(.0) being the highest possible rating. Other rating systems with different ranges will have to be scaled. |
Tag Name | Type | Description |
---|---|---|
ENCODER | UTF-8 | The software or hardware used to encode this item. ("LAME" or "XviD") |
ENCODER_SETTINGS | UTF-8 | A list of the settings used for encoding this item. No specific format. |
BPS | UTF-8 | The average bits per second of the specified item. This is only the data in the Blocks, and excludes headers and any container overhead. |
FPS | UTF-8 | The average frames per second of the specified item. This is typically the average number of Blocks per second. In the event that lacing is used, each laced chunk is to be counted as a separate frame. |
BPM | UTF-8 | Average number of beats per minute in the complete target (e.g. a chapter). Usually a decimal number. |
MEASURE | UTF-8 | In music, a measure is a unit of time in Western music like "4/4". It represents a regular grouping of beats, a meter, as indicated in musical notation by the time signature.. The majority of the contemporary rock and pop music you hear on the radio these days is written in the 4/4 time signature. |
TUNING | UTF-8 | It is saved as a frequency in hertz to allow near-perfect tuning of instruments to the same tone as the musical piece (e.g. "441.34" in Hertz). The default value is 440.0 Hz. |
REPLAYGAIN_GAIN | binary | The gain to apply to reach 89dB SPL on playback. This is based on the Replay Gain standard. Note that ReplayGain information can be found at all TargetType levels (track, album, etc). |
REPLAYGAIN_PEAK | binary | The maximum absolute peak value of the item. This is based on the Replay Gain standard. |
Tag Name | Type | Description |
---|---|---|
ISRC | UTF-8 | The International Standard Recording Code, excluding the "ISRC" prefix and including hyphens. |
MCDI | binary | This is a binary dump of the TOC of the CDROM that this item was taken from. This holds the same information as the MCDI in ID3. |
ISBN | UTF-8 | International Standard Book Number |
BARCODE | UTF-8 | EAN-13 (European Article Numbering) or UPC-A (Universal Product Code) bar code identifier |
CATALOG_NUMBER | UTF-8 | A label-specific string used to identify the release (TIC 01 for example). |
LABEL_CODE | UTF-8 | A 4-digit or 5-digit number to identify the record label, typically printed as (LC) xxxx or (LC) 0xxxx on CDs medias or covers (only the number is stored). |
LCCN | UTF-8 | Library of Congress Control Number |
Tag Name | Type | Description |
---|---|---|
PURCHASE_ITEM | UTF-8 | URL to purchase this file. This is akin to the WPAY tag in ID3. |
PURCHASE_INFO | UTF-8 | Information on where to purchase this album. This is akin to the WCOM tag in ID3. |
PURCHASE_OWNER | UTF-8 | Information on the person who purchased the file. This is akin to the TOWN tag in ID3. |
PURCHASE_PRICE | UTF-8 | The amount paid for entity. There SHOULD only be a numeric value in here. Only numbers, no letters or symbols other than ".". For instance, you would store "15.59" instead of "$15.59USD". |
PURCHASE_CURRENCY | UTF-8 | The currency type used to pay for the entity. Use ISO-4217 for the 3 letter currency code. |
Tag Name | Type | Description |
---|---|---|
COPYRIGHT | UTF-8 | The copyright information as per the copyright holder. This is akin to the TCOP tag in ID3. |
PRODUCTION_COPYRIGHT | UTF-8 | The copyright information as per the production copyright holder. This is akin to the TPRO tag in ID3. |
LICENSE | UTF-8 | The license applied to the content (like Creative Commons variants). |
TERMS_OF_USE | UTF-8 | The terms of use for this item. This is akin to the USER tag in ID3. |
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, error recovery files, picture or text-based annotations, copies of specifications, or other ancilliary files related to the Segment.
Matroska Readers MUST NOT execute files stored as Attachments.
This section defines a set of guidelines for the storage of cover art in Matroska files. A Matroska Reader MAY use embedded cover art to display a representation still-image depiction of the multimedia contents of the Matroska file.
Cover art SHOULD only use the JPEG and PNG picture formats.
There can be 2 different covers 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 cover and the small cover. The dimension of the normal cover SHOULD be 600 on the smallest side (for example, 960x600 for landscape, 600x800 for portrait, or 600x600 for square). The dimension of the small cover SHOULD be 120 on the smallest side (for example, 192x120 or 120x160).
Versions of cover art can be differentiated by the filename, which is stored in the FileName Element. The default filename of the normal cover in square or portrait mode is cover.(jpg|png). When stored, the normal cover SHOULD be the first Attachment in storage order. The small cover SHOULD be prefixed with "small_", such as small_cover.(jpg|png). The landscape variant SHOULD be suffixed with "_land", such as cover_land.(jpg|png). The filenames are case sensitive and SHOULD all be lower case.
The following table provides examples of file names for cover art in Attachments.
FileName | Image Orientation | Pixel Length of Smallest Side cover.jpg | Portrait or square | 600 small_cover.png | Portrait or square | 120 cover_land.png | Landscape | 600 small_cover_land.jpg | Landscape | 120
The Cues Element provides an index of certain Cluster Elements to allow for optimized seeking to absolute timestamps within the Segment. The Cues Element contains one or many CuePoint Elements which each MUST reference an absolute timestamp (via the CueTime Element), a Track (via the CueTrack Element), and a Segment Position (via the CueClusterPosition Element). Additional non-mandated Elements are part of the CuePoint Element such as CueDuration, CueRelativePosition, CueCodecState and others which provide any potential Matroska reader with additional information to use in the optimization of seeking performance.
The following recommendations are provided to optimize Matroska performance.
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 highlight 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 menus. But in that case, the hotspot will have to be associated with a name to display.
So this highlight is sent from the Control Track to the Player. Then the player has to handle that highlight until it's deactivated (see Playback features)
The highlight 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 written 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 encounter 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.
[RFC3339] | Klyne, G. and C. Newman, "Date and Time on the Internet: Timestamps", RFC 3339, DOI 10.17487/RFC3339, July 2002. |
[RFC6386] | Bankoski, J., Koleszar, J., Quillio, L., Salonen, J., Wilkins, P. and Y. Xu, "VP8 Data Format and Decoding Guide", RFC 6386, DOI 10.17487/RFC6386, November 2011. |