Codec Mapping
A Codec Mapping is a set of attributes to identify, name, and contextualize 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
CodecID to identify and describe the format of the encoded data in its associated Clusters.
This CodecID is an identifier, uniquely defined in the Matroska Codec IDs Registry (#matroska-codec-ids-registry), that represents the encoding stored within
the Track. Certain encodings also require some form of codec initialization
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 CodecID so that all developers supporting Matroska will use the
same CodecID.
Defining Matroska Codec Support
Support for a codec is defined in Matroska with the following values.
Codec ID
Each codec supported for storage in Matroska MUST have a unique CodecID.
Each CodecID MUST be prefixed with the string from the following table according to
the associated Track 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 (“_”).
| Track Type | Codec ID Prefix |
|---|---|
| Video (1) | “V_” |
| Audio (2) | “A_” |
| Complex (3) | “O_” |
| Logo (16) | “L_” |
| Subtitle (17) | “S_” |
| Button (18) | “B_” |
| Control (32) | “C_” |
| Metadata (33) | “M_” |
Table: Codec ID Prefix by Track Type{#CodecPrefix}
Each CodecID 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 CodecID 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 | A_AAC/MPEG2/LC/SBR |
| V_ | MPEG4 | / | ISO/ASP | V_MPEG4/ISO/ASP |
| V_ | MPEG1 | V_MPEG1 |
Table: Codec ID Components{#CodecComponents}
Codec Name
Each encoding supported for storage in Matroska MUST have a Codec Name.
The Codec Name provides a readable label for the encoding.
Description
An optional description for the encoding. This value is only intended for human consumption.
Initialization
Each encoding supported for storage in Matroska MUST have a defined Initialization.
The Initialization MUST describe the storage of data necessary to initialize the decoder,
which MUST be stored within the CodecPrivate element. When the Initialization is updated
within a track, then that updated Initialization data MUST be written into the CodecState element
of the first Cluster to require it. If the encoding does not require any form of Initialization,
then none MUST be used to define the Initialization and the CodecPrivate element
SHOULD NOT be written and MUST be ignored.
If the TrackEntry contains a CodecPrivate element, its data MUST be provided to the decoder.
Codec BlockAdditions
Additional data that contextualizes or supplements a Block can be stored within
the BlockAdditional element of a BlockMore element [@!RFC9559, section 5.1.3.5.2.1].
Each BlockAdditional is coupled with a BlockAddID that identifies the kind of data it contains.
A BlockAddID of 1 means the data in the BlockAdditional element are tied to the codec.
This BlockAdditional data with a BlockAddID of 1 MAY be passed to the associated decoder alongside the Block content .
A codec definition MUST contain a “Codec BlockAdditions” section if the codec can use BlockAdditional data with a BlockAddID of 1.
The BlockAddID values are defined in (#block-additional-mapping).
Citation
Documentation of the associated normative and informative references for the codec is RECOMMENDED.
Superseded By
When a Superseded By is set, the superseding CodecID value MUST be used instead of the superseded CodecID.
Files MAY exist with the superseded CodecID and MAY be supported by Matroska Players.
Recommendations for the Creation of New Codec Mappings
Creators of a new Codec Mapping to be used in the context of Matroska:
-
MUST assume that all
Codec Mappingsthey create might become standardized, public, commonly deployed, or usable across multiple implementations. -
MUST employ meaningful values for
CodecIDandCodec Namethat are not already included in the Matroska Codec IDs Registry, and are not otherwise known or suspected to be in use, even if they are not already registered. -
MUST NOT prefix their
CodecIDwith “X_” or similar constructs.
These recommendations are based on [@!RFC6648, section 3].
Video Codec Mappings
All codecs described in this section MUST have a TrackType ([@!RFC9559, section 5.1.4.1.3]) value of “1” for video.
The track using these codecs MUST contain a Video element – i.e., EBML Path \Segment\Tracks\TrackEntry\Video.
Most video codecs contain meta information about the data they contain, like encoded width and height, chroma subsampling, etc.
Whenever possible these information inside the codec SHOULD be extracted and repeated at the Matroska level with
the appropriate element(s) inside the \Segment\Tracks\TrackEntry\Video and \Segment\Tracks\TrackEntry elements.
These values MUST be valid for the whole Segment.
V_AV1
Codec ID: V_AV1
Codec Name: Alliance for Open Media AV1 Video codec
Description: Only one Sequence Header OBU, as defined in section 6.4 of [@!AV1], is supported per Matroska Segment.
Each Block contains one Temporal Unit containing one or more OBUs. Each OBU stored in the Block MUST contain its header and its payload.
The OBUs in the Block follow the Low Overhead Bitstream Format syntax.
They MUST have the obu_has_size_field set to 1 except for the last OBU in the frame, for which obu_has_size_field MAY be set to 0, in which case it is assumed to fill the remainder of the frame.
A SimpleBlock MUST NOT be marked as a Keyframe if it doesn’t contain a Frame OBU.
A SimpleBlock MUST NOT be marked as a Keyframe if the first Frame OBU doesn’t have a frame_type of KEY_FRAME.
A SimpleBlock MUST NOT be marked as a Keyframe if it doesn’t contain a Sequence Header OBU.
A Block inside a BlockGroup MUST use ReferenceBlock elements if the first Frame OBU in the Block has a frame_type other than KEY_FRAME.
A Block inside a BlockGroup MUST use ReferenceBlock elements if the Block doesn’t contain a Sequence Header OBU.
A Block with frame_header_obu where the frame_type is INTRA_ONLY_FRAME MUST use a ReferenceBlock with a value of 0 to reference itself.
Initialization: The CodecPrivate consists of the AV1CodecConfigurationRecord described in section 2.3 of [@!AV1-ISOBMFF].
PixelWidth: MUST be max_frame_width_minus_1+1 of the Sequence Header OBU.
PixelHeight: MUST be max_frame_height_minus_1+1 of the Sequence Header OBU.
V_AVS2
Codec ID: V_AVS2
Codec Name: AVS2-P2/IEEE.1857.4
Description: Individual pictures of AVS2-P2 stored as described in the second part of [@!IEEE.1857-4].
Initialization: none
V_AVS3
Codec ID: V_AVS3
Codec Name: AVS3-P2/IEEE.1857.10
Description: Individual pictures of AVS3-P2 stored as described in the second part of [@!IEEE.1857-10].
Initialization: none
V_CAVS
Codec ID: V_CAVS
Codec Name: AVS1-P2, JiZhun profile
Description: Individual pictures of AVS1-P2 stored as described in [@!IEEE.1857-3].
Initialization: none
V_DIRAC
Codec ID: V_DIRAC
Codec Name: BBC Dirac
Description: A video codec developed by the BBC [@Dirac]. The Intra-only version of Dirac, also known as Dirac Pro, resulted in SMPTE VC-2 [@SMPTE.ST2042-1]. Each Matroska frame corresponds to a Sequence as defined in [@!Dirac].
Initialization: none
V_FFV1
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. [@!RFC9043]
Initialization: For FFV1 versions 0 or 1, CodecPrivate SHOULD NOT be written.
For FFV1 version 3 or greater, the CodecPrivate MUST contain the FFV1 Configuration Record structure, as defined in [@!RFC9043, section 4.3], and no other data.
V_JPEG2000
Codec ID: V_JPEG2000
Codec Name: JPEG 2000
Description: Each Matroska frame corresponds to a JPEG 2000 image, as defined in [@!JPEG2000].
Initialization: none
V_MJPEG
Codec ID: V_MJPEG
Codec Name: Motion JPEG
Description: Motion JPEG is a video compression format in which each video frame or interlaced field is compressed separately as a [@!JPEG] image.
Initialization: none
V_MPEGH/ISO/HEVC
Codec ID: V_MPEGH/ISO/HEVC
Codec Name: HEVC/H.265
Description: Individual pictures (which could be a frame, a field, or 2 fields having the same timestamp) of HEVC/H.265 stored as described in [@!ISO.14496-15].
Initialization: The CodecPrivate contains a HEVCDecoderConfigurationRecord structure, as defined in [@!ISO.14496-15].
V_MPEGI/ISO/VVC
Codec ID: V_MPEGI/ISO/VVC
Codec Name: VVC/H.266
Description: Individual pictures (which could be a frame, a field, or 2 fields having the same timestamp) of VVC/H.266 stored as described in [@!ISO.14496-15].
Initialization: The CodecPrivate contains a VVCDecoderConfigurationRecord structure, as defined in [@!ISO.14496-15].
V_MPEG1
Codec ID: V_MPEG1
Codec Name: MPEG 1
Description: Frames correspond to a Video Sequence as defined in [@!ISO.11172-2].
Initialization: none
V_MPEG2
Codec ID: V_MPEG2
Codec Name: MPEG 2
Description: Frames correspond to a Video Sequence as defined in [@!ITU-T.H.262].
Initialization: none
V_MPEG4/ISO/AVC
Codec ID: V_MPEG4/ISO/AVC
Codec Name: AVC/H.264
Description: Individual pictures (which could be a frame, a field, or 2 fields having the same timestamp) of AVC/H.264 stored as described in [@!ISO.14496-15].
Initialization: The CodecPrivate contains an AVCDecoderConfigurationRecord structure, as defined in [@!ISO.14496-15].
For legacy reasons, because Block Additional Mappings are preferred; see (#block-additional-mapping),
the AVCDecoderConfigurationRecord structure MAY be followed by an extension block beginning
with a 4-byte extension block size field in big-endian byte order which is the size of the extension block
minus 4 (excluding the size of the extension block size field) and a 4-byte field corresponding
to a BlockAddIDType of “mvcC” followed by a content corresponding to the content of BlockAddIDExtraData for mvcC; see (#mvcc).
V_MPEG4/ISO/AP
Codec ID: V_MPEG4/ISO/AP
Codec Name: MPEG4 ISO Advanced Profile
Description: Frames correspond to frames defined in [@!ISO.14496-2].
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 original streams,
when being compared to a VfW created stream, as here there are no dummy frames inserted.
Initialization: none
V_MPEG4/ISO/ASP
Codec ID: V_MPEG4/ISO/ASP
Codec Name: MPEG4 ISO Advanced Simple Profile (DivX5, XviD)
Description: Frames correspond to frames defined in [@!ISO.14496-2].
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 original streams,
when being compared to a VfW created stream, as here there are no dummy frames inserted.
Initialization: none
V_MPEG4/ISO/SP
Codec ID: V_MPEG4/ISO/SP
Codec Name: MPEG4 ISO Simple Profile (DivX4)
Description: Frames correspond to frames defined in [@!ISO.14496-2]. Stream was created via improved codec API (UCI) or even transmuxed from AVI (no b-frames in Simple Profile).
Initialization: none
V_MPEG4/MS/V3
Codec ID: V_MPEG4/MS/V3
Codec Name: Microsoft MPEG4 V3
Description: Microsoft MPEG4 V3 and derivatives, means DivX3, Angelpotion, SMR, etc.; stream was created using
VfW codec or transmuxed from AVI; note that V1/V2 are covered by the “V_MS/VFW/FOURCC” CodecID (#v-ms-vfw-fourcc).
Initialization: none
V_MS/VFW/FOURCC
Codec ID: V_MS/VFW/FOURCC
Codec Name: Microsoft Video Codec Manager (VCM)
Description: Video frames originating from Video For Windows, using the Microsoft Video Codec Manager codecs. This is a codec designed to be transmuxed back and forth from AVI sources.
Initialization: The CodecPrivate contains the VCM structure BITMAPINFOHEADER including
the extra private bytes, as defined in [@!BITMAPINFOHEADER].
The data are stored in little-endian format (like on IA32 machines).
V_QUICKTIME
Codec ID: V_QUICKTIME
Codec Name: Video taken from QuickTime files
Description: Several codecs as stored in QuickTime (e.g., Sorenson or Cinepak).
Initialization: The CodecPrivate contains all additional data that is stored in the ‘stsd’ (sample description) atom
in the QuickTime file after the mandatory video descriptor structure
(starting with the size and FourCC fields). For an explanation of the QuickTime file format read [@!QTFF].
V_PRORES
Codec ID: V_PRORES
Codec Name: Apple ProRes
Initialization: The CodecPrivate contains the FourCC as found in MP4 movies:
-
ap4x: ProRes 4444 XQ
-
ap4h: ProRes 4444
-
apch: ProRes 422 High Quality
-
apcn: ProRes 422 Standard Definition
-
apcs: ProRes 422 LT
-
apco: ProRes 422 Proxy
-
aprh: ProRes RAW High Quality
-
aprn: ProRes RAW Standard Definition
ProRes is defined as [@!SMPTE.RDD36].
V_REAL/RV10
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.
Initialization: The CodecPrivate contains a real_video_props_t structure in big-endian byte order as found in [@!librmff].
V_REAL/RV20
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.
Initialization: The CodecPrivate contains a real_video_props_t structure in big-endian byte order as found in [@!librmff].
V_REAL/RV30
Codec ID: V_REAL/RV30
Codec Name: RealVideo 8
Description: Individual slices from the Real container are combined into a single frame.
Initialization: The CodecPrivate contains a real_video_props_t structure in big-endian byte order as found in [@!librmff].
V_REAL/RV40
Codec ID: V_REAL/RV40
Codec Name: rv40 : RealVideo 9
Description: Individual slices from the Real container are combined into a single frame.
Initialization: The CodecPrivate contains a real_video_props_t structure in big-endian byte order as found in [@!librmff].
V_THEORA
Codec ID: V_THEORA
Codec Name: Theora
Description: Frames correspond to a Theora Frame as defined in [@!Theora].
Initialization: The CodecPrivate contains the first three Theora packets in order. The lengths of the packets precedes them. The actual layout is:
-
Byte 1: number of distinct packets
#pminus one inside theCodecPrivateblock. This MUST be “2” for current (as of 2016-07-08) Theora headers. -
Bytes 2..n: lengths of the first
#ppackets, coded in Xiph-style lacing. The length of the last packet is the length of theCodecPrivateblock minus the lengths coded in these bytes minus one. -
Bytes n+1..: The Theora identification header, followed by the commend header followed by the codec setup header. Those are described in the [@!Theora].
V_UNCOMPRESSED
Codec ID: V_UNCOMPRESSED
Codec Name: Video, raw uncompressed video frames
Description: The codec doesn’t use any form of compression. All the relevant fields of the TrackEntry\Video element MUST be filled to play this content correctly.
In addition the packing of RGB, YUV, etc. pixels MUST be declared with a TrackEntry\Video\UncompressedFourCC element with values defined in [@!RFC9559, section 5.1.4.1.28.15].
Initialization: none
V_VC1
Codec ID: V_VC1
Codec Name: VC-1
Description: Frames correspond to VC-1 samples as defined in [@!SMPTE.RP2025-2007].
Initialization: The CodecPrivate contains a VC1DecSpecStruc structure, as defined in [@!SMPTE.RP2025-2007].
V_VP8
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]
Codec BlockAdditions: A single-channel encoding of an alpha channel MAY be stored in BlockAdditions. The BlockAddID of the BlockMore containing these data MUST be 1.
Initialization: none
V_VP9
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. [@!VP9]
Codec BlockAdditions: A single-channel encoding of an alpha channel MAY be stored in BlockAdditions. The BlockAddID of the BlockMore containing these data MUST be 1.
Initialization: Encoders are strongly encouraged to provide a CodecPrivate that contains a list of specific VP9 codec features as described in the “VP9 Codec Feature Metadata” section of [@!WebMContainer].
This piece of data helps to select a decoder on playback, but as many muxers don’t provide the CodecPrivate for “V_VP9” it is not a hard requirement.
It is possible for the decoder to reconstruct the “VP9 Codec Feature Metadata” from the first frame in case the CodecPrivate is not present.
Note that the format differs from the VPCodecConfigurationRecord structure, as defined in [@VP-ISOBMFF].
Audio Codec Mappings
All codecs described in this section MUST have a TrackType ([@!RFC9559, section 5.1.4.1.3]) value of “2” for audio.
The track using these codecs MUST contain an Audio element – i.e., EBML Path \Segment\Tracks\TrackEntry\Audio.
Most audio codecs contain meta information about the data they contain, like encoded sampling frequency, channel count, etc.
Whenever possible these information inside the codec SHOULD be extracted and repeated at the Matroska level with
the appropriate element(s) inside the \Segment\Tracks\TrackEntry\Audio and \Segment\Tracks\TrackEntry elements.
These values MUST be valid for the whole Segment.
A_AAC
Codec ID: A_AAC
Codec Name: Advanced Audio Coding (AAC)
Description: Individual frames of AAC raw_data_block(), stored as defined in subpart 4 of [@!ISO.14496-3].
Initialization: The CodecPrivate contains an AudioSpecificConfig structure, as defined in [@!ISO.14496-3].
A_AAC/MPEG2/LC
Codec ID: A_AAC/MPEG2/LC
Codec Name: Low Complexity
Description: The audio stream is stripped from ADTS headers and normal Matroska frame based muxing scheme is applied.
Initialization: none
Superseded By: A_AAC ((#a-aac))
A_AAC/MPEG2/LC/SBR
Codec ID: A_AAC/MPEG2/LC/SBR
Codec Name: Low Complexity with Spectral Band Replication
Description: The audio stream is stripped from ADTS headers and normal Matroska frame based muxing scheme is applied.
Initialization: none
Superseded By: A_AAC ((#a-aac))
A_AAC/MPEG2/MAIN
Codec ID: A_AAC/MPEG2/MAIN
Codec Name: MPEG2 Main Profile
Description: The audio stream is stripped from ADTS headers and normal Matroska frame based muxing scheme is applied.
Initialization: none
Superseded By: A_AAC ((#a-aac))
A_AAC/MPEG2/SSR
Codec ID: A_AAC/MPEG2/SSR
Codec Name: Scalable Sampling Rate
Description: The audio stream is stripped from ADTS headers and normal Matroska frame based muxing scheme is applied.
Initialization: none
Superseded By: A_AAC ((#a-aac))
A_AAC/MPEG4/LC
Codec ID: A_AAC/MPEG4/LC
Codec Name: Low Complexity
Description: The audio stream is stripped from ADTS headers and normal Matroska frame based muxing scheme is applied.
Initialization: none
Superseded By: A_AAC ((#a-aac))
A_AAC/MPEG4/LC/SBR
Codec ID: A_AAC/MPEG4/LC/SBR
Codec Name: Low Complexity with Spectral Band Replication
Description: The audio stream is stripped from ADTS headers and normal Matroska frame based muxing scheme is applied.
Initialization: none
Superseded By: A_AAC ((#a-aac))
A_AAC/MPEG4/LTP
Codec ID: A_AAC/MPEG4/LTP
Codec Name: Long Term Prediction
Description: The audio stream is stripped from ADTS headers and normal Matroska frame based muxing scheme is applied.
Initialization: none
Superseded By: A_AAC ((#a-aac))
A_AAC/MPEG4/MAIN
Codec ID: A_AAC/MPEG4/MAIN
Codec Name: MPEG4 Main Profile
Description: The audio stream is stripped from ADTS headers and normal Matroska frame based muxing scheme is applied.
Initialization: none
Superseded By: A_AAC ((#a-aac))
A_AAC/MPEG4/SSR
Codec ID: A_AAC/MPEG4/SSR
Codec Name: Scalable Sampling Rate
Description: The audio stream is stripped from ADTS headers and normal Matroska frame based muxing scheme is applied.
Initialization: none
Superseded By: A_AAC ((#a-aac))
A_AC3
Codec ID: A_AC3
Codec Name: Dolby Digital / AC-3
Description: Individual frames of AC-3 syncframe() stored as described in [@!ATSC.A52] or [@!ETSI.TS102-366] when the value of the bsid field defined in Section 5.4.2.1 of [@!ATSC.A52] or Section 4.4.2.1 of [@!ETSI.TS102-366] is 10 or below.
Channel number have to be read from the corresponding audio element
Initialization: none
A_AC3/BSID9
Codec ID: A_AC3/BSID9
Codec Name: Dolby Digital / AC-3
Description: Individual frames of AC-3 syncframe() stored as described in [@!ATSC.A52] or [@!ETSI.TS102-366] when the value of the bsid field defined in Section 5.4.2.1 of [@!ATSC.A52] or Section 4.4.2.1 of [@!ETSI.TS102-366] is 9.
Note that the value 9 in the bsid field is not standard but it is defacto used for dividing the sampling rate defined in Section 5.4.1.3 of [@!ATSC.A52] or Section 4.4.2.1 of [@!ETSI.TS102-366] by 2.
Using this Codec ID is NOT RECOMMENDED as many Matroska Players don’t support it. The generic A_AC3 Codec ID SHOULD be used instead as it supports a bsid of 9 as well.
Initialization: none
A_AC3/BSID10
Codec ID: A_AC3/BSID10
Codec Name: Dolby Digital / AC-3
Description: Individual frames of AC-3 syncframe() stored as described in [@!ATSC.A52] or [@!ETSI.TS102-366] when the value of the bsid field defined in Section 5.4.2.1 of [@!ATSC.A52] or Section 4.4.2.1 of [@!ETSI.TS102-366] is 10.
Note that the value 10 in the bsid field is not standard but it is defacto used for dividing the sampling rate defined in Section 5.4.1.3 of [@!ATSC.A52] or Section 4.4.2.1 of [@!ETSI.TS102-366] by 4.
Using this Codec ID is NOT RECOMMENDED as many Matroska Players don’t support it. The generic A_AC3 Codec ID SHOULD be used instead as it supports a bsid of 10 as well.
Initialization: none
A_ALAC
Codec ID: A_ALAC
Codec Name: ALAC (Apple Lossless Audio Codec)
Initialization: The CodecPrivate contains ALAC’s magic cookie (both the codec specific configuration as well as the optional channel layout information).
Its format is described in the “Magic Cookie” defined in [@!ALAC].
A_ATRAC/AT1
Codec ID: A_ATRAC/AT1
Codec Name: Sony ATRAC1 Codec
Description: The original ATRAC codec by Sony, mainly used in MiniDisc platforms. The core technical details on ATRAC1 can be found in [@?AtracAES]. An example encoder/decoder can be found at [@?atracdenc].
Initialization: None
A_DTS
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. It corresponds to the base codec defined in [@!ETSI.TS102-114].
Initialization: none
A_DTS/EXPRESS
Codec ID: A_DTS/EXPRESS
Codec Name: Digital Theatre System Express
Description: DTS Express (a.k.a. LBR) audio streams. It corresponds to the LBR extension of the DTS codec defined in section 9 of [@!ETSI.TS102-114].
Initialization: none
A_DTS/LOSSLESS
Codec ID: A_DTS/LOSSLESS
Codec Name: Digital Theatre System Lossless
Description: DTS Lossless audio that does not have a core substream. It corresponds to the Lossless extension (XLL) of the DTS codec defined in section 8 of [@!ETSI.TS102-114].
Initialization: none
A_EAC3
Codec ID: A_EAC3
Codec Name: Dolby Digital Plus / E-AC-3
Description: Individual frames of E-AC-3 syncframe() stored as described in [@!ATSC.A52] or [@!ETSI.TS102-366] when the value of the bsid field defined in Annex E Section 2.1 of [@!ATSC.A52] or Section E.1.3.1.6 of [@!ETSI.TS102-366] is 11, 12, 13, 14, 15 or 16.
Initialization: none
A_FLAC
Codec ID: A_FLAC
Codec Name: FLAC (Free Lossless Audio Codec)
Description: The mapping of the FLAC framing and CodecPrivate is described in [@!RFC9639, section 10.2].
Initialization: All FLAC data before the first audio frame; see [@!RFC9639, section 10.2].
A_MLP
Codec ID: A_MLP
Codec Name: Meridian Lossless Packing / MLP
Description: A lossless audio codec used in DVD-Audio discs. The format is similar to Dolby TrueHD ((#a-truehd)) but with fewer channels.
Initialization: none
A_MPEG/L1
Codec ID: A_MPEG/L1
Codec Name: MPEG Audio 1, 2 Layer I
Description: Frames correspond to Audio Frames of a Layer I bitstream as defined in [@!ISO.11172-3].
Initialization: none
A_MPEG/L2
Codec ID: A_MPEG/L2
Codec Name: MPEG Audio 1, 2 Layer II
Description: Frames correspond to Audio Frames of a Layer II bitstream as defined in [@!ISO.11172-3].
Initialization: none
A_MPEG/L3
Codec ID: A_MPEG/L3
Codec Name: MPEG Audio 1, 2, 2.5 Layer III
Description: Frames correspond to Audio Frames of a Layer III bitstream as defined in [@!ISO.11172-3].
Initialization: none
A_MS/ACM
Codec ID: A_MS/ACM
Codec Name: Microsoft Audio Codec Manager (ACM)
Description: The data are stored in little-endian format (like on IA32 machines).
Initialization: The CodecPrivate contains the [@!WAVEFORMATEX] structure including the extra format information bytes.
The structure is stored without packing or padding bytes.
A WORD corresponds to a signed 2 octets integer, DWORD corresponds to a signed 4 octets integer.
The extra format information are appended after the WAVEFORMATEX octets.
A_REAL/14_4
Codec ID: A_REAL/14_4
Codec Name: Real Audio 1
Initialization: The CodecPrivate 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].
A_REAL/28_8
Codec ID: A_REAL/28_8
Codec Name: Real Audio 2
Initialization: The CodecPrivate 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].
A_REAL/ATRC
Codec ID: A_REAL/ATRC
Codec Name: Sony Atrac3 Codec
Initialization: The CodecPrivate 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].
A_REAL/COOK
Codec ID: A_REAL/COOK
Codec Name: Real Audio Cook Codec (codename: Gecko)
Initialization: The CodecPrivate 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].
A_REAL/RALF
Codec ID: A_REAL/RALF
Codec Name: Real Audio Lossless Format
Initialization: The CodecPrivate 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].
A_REAL/SIPR
Codec ID: A_REAL/SIPR
Codec Name: Sipro Voice Codec
Initialization: The CodecPrivate 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].
A_OPUS
Codec ID: A_OPUS
Codec Name: Opus interactive speech and audio codec
Description: The OPUS audio codec defined by [@!RFC6716] using a similar encapsulation as the Ogg Encapsulation [@!RFC7845].
Initialization: The track CodecPrivate MUST be present and contain the Identification Header defined in [@!RFC7845, section 5.1].
Channels: The track Channels element value MUST be the “Output Channel Count” value of the Identification Header.
SamplingFrequency: The track SamplingFrequency element value MUST be the “Input Sample Rate” value of the Identification Header.
CodecDelay: The track CodecDelay element MUST be present and set to the “Pre-skip” value of the Identification Header translated to Matroska Ticks.
The “Pre-skip” value is in samples at 48,000 Hz. The formula to get the CodecDelay is:
CodecDelay = pre-skip * 1,000,000,000 / 48,000.
SeekPreRoll: The track SeekPreRoll element SHOULD be present and set to 80,000,000 – 80 ms in Matroska Ticks –
in order to ensure that the output audio is correct by the time it reaches the seek target.
A_PCM/FLOAT/IEEE
Codec ID: A_PCM/FLOAT/IEEE
Codec Name: Floating-Point, IEEE compatible
Description: The audio bit depth MUST be read and set from the BitDepth element (32 bits in most cases).
The floats are stored as defined in [@!IEEE.754] and in little-endian order.
Although [@!IEEE.754] supports “Not a Number” (“NaN”) values, if these values are present, the player behavior is unspecified and unpredictable.
Initialization: none
A_PCM/INT/BIG
Codec ID: A_PCM/INT/BIG
Codec Name: PCM Integer Big Endian
Description: The audio bit depth MUST be read and set from the BitDepth element. Audio samples MUST be considered as signed values,
unless the audio bit depth is 8 which MUST be interpreted as unsigned values.
Initialization: none
A_PCM/INT/LIT
Codec ID: A_PCM/INT/LIT
Codec Name: PCM Integer Little Endian
Description: The audio bit depth MUST be read and set from the BitDepth element. Audio samples MUST be considered as signed values,
unless the audio bit depth is 8 which MUST be interpreted as unsigned values.
Initialization: none
A_QUICKTIME
Codec ID: A_QUICKTIME
Codec Name: Audio taken from QuickTime files
Description: Several codecs as stored in QuickTime (e.g., QDesign Music v1 or v2).
Initialization: The CodecPrivate contains all additional data that is stored in the ‘stsd’ (sample description) atom
in the QuickTime file after the mandatory sound descriptor structure (starting with the size and FourCC fields).
For an explanation of the QuickTime file format read [@!QTFF].
A_QUICKTIME/QDMC
Codec ID: A_QUICKTIME/QDMC
Codec Name: QDesign Music
Description:
Initialization: The CodecPrivate contains all additional data that is stored in the ‘stsd’ (sample description) atom
in the QuickTime file after the mandatory sound descriptor structure (starting with the size and FourCC fields).
For an explanation of the QuickTime file format read [@!QTFF].
Superseded By: A_QUICKTIME ((#a-quicktime))
A_QUICKTIME/QDM2
Codec ID: A_QUICKTIME/QDM2
Codec Name: QDesign Music v2
Description:
Initialization: The CodecPrivate contains all additional data that is stored in the ‘stsd’ (sample description) atom
in the QuickTime file after the mandatory sound descriptor structure (starting with the size and FourCC fields).
For an explanation of the QuickTime file format read [@!QTFF].
Superseded By: A_QUICKTIME ((#a-quicktime))
A_TRUEHD
Codec ID: A_TRUEHD
Codec Name: Dolby TrueHD
Description: Lossless audio codec from Dolby. Each Matroska frame corresponds to a single Access Unit as defined in [@!TRUEHD].
Initialization: none
A_TTA1
Codec ID: A_TTA1
Codec Name: The True Audio lossless audio compressor
Description: The format is described in [@!TTA].
Each frame is kept intact, including the CRC32. The header and seektable are dropped. SamplingFrequency, Channels and BitDepth are used in the TrackEntry.
Initialization: The CodecPrivate contains the TTA Header Structure, as defined in [@!TTA].
A_VORBIS
Codec ID: A_VORBIS
Codec Name: Vorbis
Initialization: The CodecPrivate 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
#pminus one inside theCodecPrivateblock. This MUST be “2” for current (as of 2016-07-08) Vorbis headers. -
Bytes 2..n: lengths of the first
#ppackets, coded in Xiph-style lacing. The length of the last packet is the length of theCodecPrivateblock minus the lengths coded in these bytes minus one. -
Bytes n+1..: The “Identification Header” as defined in Section 4.2.2 of [@!VORBIS], followed by the “Comment Header” as defined in Section 5 of [@!VORBIS], followed by the “Setup Header” as defined in Section 4.2.4 of [@!VORBIS].
A_WAVPACK4
Codec ID: A_WAVPACK4
Codec Name: WavPack lossless audio compressor
Description: The WavPack packets consist of a block defined in [@!WAVPACK] with a WavpackHeader header.
For multichannel (> 2 channels) a frame consists of many packets. For more details, check the WavPack muxing description (#wavpack).
Codec BlockAdditions: For hybrid A_WAVPACK4 encodings (that include a lossy encoding with a supplemental correction
to produce a lossless encoding), the correction part is stored in BlockAdditional.
The BlockAddID of the BlockMore containing these data MUST be 1.
Initialization: The CodecPrivate contains the version 16-bit integer from the WavpackHeader of [@!WAVPACK] stored in little-endian.
Subtitle Codec Mappings
All codecs described in this section MUST have a TrackType ([@!RFC9559, section 5.1.4.1.3]) value of “17” for subtitles.
Subtitle codecs often contain meta information about the data they contain, like expected output dimension, language, etc.
Whenever possible these information inside the codec SHOULD be extracted and repeated at the Matroska level with
the appropriate element(s) inside the \Segment\Tracks\TrackEntry\Video and \Segment\Tracks\TrackEntry elements.
These values MUST be valid for the whole Segment.
S_ARIBSUB
Codec ID: S_ARIBSUB
Codec Name: ARIB STD-B24 subtitles
Description: This is the textual subtitle format used in the ISDB/ARIB broadcasting standard. For more information see (#arib-isdb-subtitles) on ARIB (ISDB) subtitles.
Initialization: The CodecPrivate data are defined in (#track-parameters-4).
S_DVBSUB
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 see (#digital-video-broadcasting-dvb-subtitles) on Digital Video Broadcasting (DVB).
Initialization: The CodecPrivate data are defined in (#track-parameters-3).
S_HDMV/PGS
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, see (#hdmv-text-subtitles) on HDMV text presentation.
Initialization: none
S_HDMV/TEXTST
Codec ID: S_HDMV/TEXTST
Codec Name: HDMV text subtitles
Description: This is the textual subtitle format used on Blu-rays. For more information, see (#hdmv-presentation-graphics-subtitles) on HDMV graphics presentation.
Initialization: The CodecPrivate data are defined in (#track-parameters-2).
S_KATE
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 “Matroska mapping” section of [@!OggKate].
The codec MAY use embedded fonts from attachments, as defined in [@?RFC9559, section 21.2], in that case the TrackEntry MUST contain an AttachmentLink element.
Initialization: Kate headers are stored in the CodecPrivate as xiph-laced packets.
The length of the last packet isn’t encoded, it is deduced from the sizes of the other packets and the total size of the CodecPrivate.
S_IMAGE/BMP
Codec ID: S_IMAGE/BMP
Codec Name: Bitmap
Description: Basic image based subtitle format; The subtitles are stored as images, like in the DVD [@?DVD-Video].
The timestamp in the block header of Matroska indicates the start display time,
the duration is set with the BlockDuration element. The full data for the subtitle bitmap
is stored in the Block’s data section.
Initialization: none
S_TEXT/ASS
Codec ID: S_TEXT/ASS
Codec Name: Advanced SubStation Alpha Format
Description: Each event is stored in its own Block.
For more information see (#ssa-ass-subtitles) on SSA/ASS.
This codec ID MUST be used when “ScriptType: v4.00+” or “[V4+ Styles]” sections are found in the original SSA script.
The codec MAY use embedded fonts from attachments, as defined in [@?RFC9559, section 21.2], in that case the TrackEntry MUST contain an AttachmentLink element.
The codec MAY also be found with the Codec ID S_ASS in legacy media containers, but using that value is NOT RECOMMENDED.
Initialization: The “[Script Info]” and “[V4 Styles]” sections are stored in the CodecPrivate.
S_TEXT/ASCII
Codec ID: S_TEXT/ASCII
Codec Name: ASCII Plain Text
Description: Basic text subtitles with only ASCII characters allowed.
Initialization: none
S_TEXT/SSA
Codec ID: S_TEXT/SSA
Codec Name: SubStation Alpha Format
Description: Each event is stored in its own Block.
For more information see (#ssa-ass-subtitles) on SSA/ASS.
This codec ID MUST NOT be used when “ScriptType: v4.00+” or “[V4+ Styles]” sections are found in the original SSA script.
The codec MAY use embedded fonts from attachments, as defined in [@?RFC9559, section 21.2], in that case the TrackEntry MUST contain an AttachmentLink element.
The codec MAY also be found with the Codec ID S_SSA, but using that value is NOT RECOMMENDED.
Initialization: The “[Script Info]” and “[V4+ Styles]” sections are stored in the CodecPrivate.
S_TEXT/USF
Codec ID: S_TEXT/USF
Codec Name: Universal Subtitle Format
Description: An XML based subtitle format.
Each BlockGroup contains XML data from a “subtitle” XML element as defined in section 3.4 of [@!USF],
without the “subtitle” element itself and with the start, stop duration mapped to the BlockGroup timestamp and BlockDuration element.
The “image” XML elements are turned into Matroska attachments and replaced in the stream with their attachment filename.
The codec MAY use embedded fonts from attachments, as defined in [@?RFC9559, section 21.2], in that case the TrackEntry MUST contain an AttachmentLink element.
Initialization: The CodecPrivate element MAY be present.
If present it MAY contain “metadata”, “styles” and “effects” XML elements usable in the whole stream inside a parent “USFSubtitles” XML parent element,
similar to the “USFSubtitles” element of a standalone USF file but without the “subtitles” XML element.
S_TEXT/UTF8
Codec ID: S_TEXT/UTF8
Codec Name: UTF-8 Plain Text
Description: Basic text subtitles. For more information see (#subtitle-codecs) on Subtitles.
Initialization: none
S_TEXT/WEBVTT
Codec ID: S_TEXT/WEBVTT
Codec Name: Web Video Text Tracks Format (WebVTT)
Description: Advanced text subtitles defined by [@!WebVTT]. For more information see (#webvtt).
Initialization: The CodecPrivate contains the WebVTT file body up to the first WebVTT cue block.
Codec BlockAdditions: Intermediate non-Cue Blocks SHOULD be stored in BlockAdditions. The BlockAddID of the BlockMore containing these data MUST be 1.
S_VOBSUB
Codec ID: S_VOBSUB
Codec Name: VobSub subtitles
Description: Uses data from [@!VobSub] files. The data represent subtitle data used on DVDs [@?DVD-Video]. VobSubs consist of two files, the .idx containing information, and the .sub, containing the actual data. Only version 7 and newer of VobSubs files are supported.
The line of the .idx file beginning with “id:” MUST be transformed into the appropriate Matroska track language element.
For each line of the .idx file containing a “timestamp:” and “filepos:” 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.
Initialization: The CodecPrivate contains the “palette:” and “size:” lines from the .idx file.
Other lines from the .idx file not containing empty lines, comments, or starting with “alt:”; “langidx:”, “id:”,
or “timestamp:” MAY be added in the CodecPrivate data for preservation.
Button Codec Mappings
All codecs described in this section MUST have a TrackType ([@!RFC9559, section 5.1.4.1.3]) value of “18” for buttons.
B_VOBBTN
Codec ID: B_VOBBTN
Codec Name: VobBtn Buttons
Description: Based on MPEG/VOB PCI packets. The frame contains a header consisting of the string “butonDVD” followed by the width and height in pixels (16-bit unsigned integer each) and 4 reserved bytes. The rest is a full PCI packet described in [@!DVD-Info.PCI].
Audio Codecs
WavPack
WavPack is an audio codec primarily designed for lossless audio, but it can also be used as a lossy codec.
[@!WAVPACK] stores each data in variable length frames. That means each frame can have a different number of samples.
Each WavPack block starts with a WavpackHeader header as defined in [@!WAVPACK], stored in little-endian.
To save space and avoid redundant information in Matroska some data from the WavpackHeader header are removed, when saved in Matroska.
All the data from the WavpackHeader are kept in little-endian.
The CodecPrivate contains the version 16-bit integer from the WavpackHeader of [@!WAVPACK] stored in little-endian.
Depending on the number of audio channels and whether the hybrid mode is kept or not, the storage of WavPack blocks in Matroska differ.
Lossless And Lossy Storage
For multichannel files (more than 2 channels, like for 5.1), a frame consists of multiple WavPack blocks.
The first one having the INITIAL_BLOCK (bit 11) flag set and the last one the FINAL_BLOCK (bit 12) flag set.
For a mono or stereo file, both flags are set in each WavPack block.
Mono/Stereo
A Block or SimpleBlock frame contains the following header with the some fields taken from the WavpackHeader
of a single WavPack block followed by the data of that WavPack block.
{
uint32_t block_samples; // # samples in this block
uint32_t flags; // various flags for id and decoding
uint32_t crc; // crc for actual decoded data
}
[ block data ]
Multichannel
For multichannel files, a WavPack file uses multiple WavPack block to store all channels of a frame.
The WavPack blocks for each channels of a frame are stored consecutively into a Matroska Block or SimpleBlock.
Each WavPack block is preceded by a header.
The header for the first WavPack block is similar to the mono/stereo one ((#mono-stereo))
with the addition of a “blocksize” field, which is the size of the first WavPack block minus the WavpackHeader size.
The header for the following WavPack blocks use the “flags” and “crc” of the WavpackHeader of each respective WavPack block,
followed with the size of each respective WavPack block minus the WavpackHeader size.
{
uint32_t block_samples; // # samples in this block
uint32_t flags; // various flags for id and decoding
uint32_t crc; // crc for actual decoded data
uint32_t blocksize; // size of the data to follow
}
[ block data # 1 ]
{
uint32_t flags; // various flags for id and decoding
uint32_t crc; // crc for actual decoded data
uint32_t blocksize; // size of the data to follow
}
[ block data # 2 ]
{
uint32_t flags; // various flags for id and decoding
uint32_t crc; // crc for actual decoded data
uint32_t blocksize; // size of the data to follow
}
[ block data # 3 ]
...
Hybrid Storage
WavPack has a hybrid mode that splits the audio frames between lossy and correction packets. Adding both gives a lossless version of the original audio. It is possible to only store the lossy part in Matroska or both together. Storing only the lossy part is equivalent to the format described in (#lossless-and-lossy-storage). This section explains how to store all hybrid data in Matroska.
Hybrid WavPack is encoded in 2 files. The first one has a lossy part and the second file has the correction part to reconstruct the original audio losslessly.
Each WavPack block in the correction file corresponds to a WavPack block in the lossy file with the same number of samples, that’s also true for a multichannel file. This means that if a frame is made of 4 WavPack blocks, the correction file will have 4 WavPack blocks in the corresponding frame. The header of the correction WavPack block is exactly the same as in the lossy WavPack block, except for the CRC.
In Matroska, the correction part is stored as an additional data available to the Block (see (#block-additional-mapping)).
This way a file could be remuxed and not keep the Block Additional data and still be usable as a lossy WavPack file.
The Block data of the lossy file are stored exactly the same as for lossy storage defined in (#lossless-and-lossy-storage).
A BlockAdditionMapping MUST be used for hybrid WavPack TrackEntry’.
The BlockAddIDType of that BlockAdditionMapping MUST be set to 1 for hybrid WavPack, corresponding to Opaque data; see (#opaque-data).
Each WavPack frame is stored in a BlockGroup that MUST have at least a BlockMore to hold the correction data.
The BlockAddID of that BlockMore MUST be 1, i.e., the default value.
Mono/Stereo
The BlockAdditional element of the correction data BlockMore contains the following header with the “crc” field from the WavpackHeader of the WavPack block of the correction file
matching the WavPack block of the lossy frame used to fill the Block data, followed by the data of that correction file WavPack block.
{
uint32_t crc; // crc for actual decoded data
}
[ correction block data ]
Multichannel
The BlockAdditional element of the correction data BlockMore contains the following header with the data from the each WavpackHeader of the WavPack block of the correction file
matching the WavPack block in the lossy file used to fill the Block data, followed by the data of the correction file WavPack block.
{
uint32_t crc; // crc for actual decoded data
uint32_t blocksize; // size of the data to follow
}
[ correction block data # 1 ]
{
uint32_t crc; // crc for actual decoded data
uint32_t blocksize; // size of the data to follow
}
[ correction block data # 2 ]
{
uint32_t crc; // crc for actual decoded data
uint32_t blocksize; // size of the data to follow
}
[ correction block data # 3 ]
...
