idnits 2.17.1 draft-ietf-cellar-codec-03.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 2 instances of too long lines in the document, the longest one being 741 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (27 October 2019) is 1644 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Informational ---------------------------------------------------------------------------- == Missing Reference: 'TM' is mentioned on line 780, but not defined == Missing Reference: 'Events' is mentioned on line 1623, but not defined Summary: 1 error (**), 0 flaws (~~), 3 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 cellar S. Lhomme 3 Internet-Draft 4 Intended status: Informational M. Bunkus 5 Expires: 29 April 2020 6 D. Rice 7 27 October 2019 9 Matroska Codec 10 draft-ietf-cellar-codec-03 12 Abstract 14 This document defines the Matroska codec mappings, including the 15 codec ID, layout of data in a "Block Element" and in an optional 16 "CodecPrivate Element". 18 Status of This Memo 20 This Internet-Draft is submitted in full conformance with the 21 provisions of BCP 78 and BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF). Note that other groups may also distribute 25 working documents as Internet-Drafts. The list of current Internet- 26 Drafts is at https://datatracker.ietf.org/drafts/current/. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 This Internet-Draft will expire on 29 April 2020. 35 Copyright Notice 37 Copyright (c) 2019 IETF Trust and the persons identified as the 38 document authors. All rights reserved. 40 This document is subject to BCP 78 and the IETF Trust's Legal 41 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 42 license-info) in effect on the date of publication of this document. 43 Please review these documents carefully, as they describe your rights 44 and restrictions with respect to this document. Code Components 45 extracted from this document must include Simplified BSD License text 46 as described in Section 4.e of the Trust Legal Provisions and are 47 provided without warranty as described in the Simplified BSD License. 49 Table of Contents 51 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 52 2. Status of this document . . . . . . . . . . . . . . . . . . . 4 53 3. Security Considerations . . . . . . . . . . . . . . . . . . . 4 54 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 4 55 5. Notations and Conventions . . . . . . . . . . . . . . . . . . 5 56 6. Codec Mappings . . . . . . . . . . . . . . . . . . . . . . . 5 57 6.1. Defining Matroska Codec Support . . . . . . . . . . . . . 5 58 6.1.1. Codec ID . . . . . . . . . . . . . . . . . . . . . . 5 59 6.1.2. Codec Name . . . . . . . . . . . . . . . . . . . . . 6 60 6.1.3. Description . . . . . . . . . . . . . . . . . . . . . 7 61 6.1.4. Initialization . . . . . . . . . . . . . . . . . . . 7 62 6.1.5. Codec BlockAdditions . . . . . . . . . . . . . . . . 7 63 6.1.6. Citation . . . . . . . . . . . . . . . . . . . . . . 8 64 6.1.7. Deprecation Date . . . . . . . . . . . . . . . . . . 8 65 6.1.8. Superseded By . . . . . . . . . . . . . . . . . . . . 8 66 6.2. Recommendations for the Creation of New Codec 67 Mappings . . . . . . . . . . . . . . . . . . . . . . . . 8 68 6.3. Video Codec Mappings . . . . . . . . . . . . . . . . . . 8 69 6.3.1. V_MS/VFW/FOURCC . . . . . . . . . . . . . . . . . . . 9 70 6.3.2. V_UNCOMPRESSED . . . . . . . . . . . . . . . . . . . 9 71 6.3.3. V_MPEG4/ISO/SP . . . . . . . . . . . . . . . . . . . 9 72 6.3.4. V_MPEG4/ISO/ASP . . . . . . . . . . . . . . . . . . . 10 73 6.3.5. V_MPEG4/ISO/AP . . . . . . . . . . . . . . . . . . . 10 74 6.3.6. V_MPEG4/MS/V3 . . . . . . . . . . . . . . . . . . . . 10 75 6.3.7. V_MPEG1 . . . . . . . . . . . . . . . . . . . . . . . 10 76 6.3.8. V_MPEG2 . . . . . . . . . . . . . . . . . . . . . . . 11 77 6.3.9. V_REAL/RV10 . . . . . . . . . . . . . . . . . . . . . 11 78 6.3.10. V_REAL/RV20 . . . . . . . . . . . . . . . . . . . . . 11 79 6.3.11. V_REAL/RV30 . . . . . . . . . . . . . . . . . . . . . 12 80 6.3.12. V_REAL/RV40 . . . . . . . . . . . . . . . . . . . . . 12 81 6.3.13. V_QUICKTIME . . . . . . . . . . . . . . . . . . . . . 12 82 6.3.14. V_THEORA . . . . . . . . . . . . . . . . . . . . . . 13 83 6.3.15. V_PRORES . . . . . . . . . . . . . . . . . . . . . . 13 84 6.3.16. V_VP8 . . . . . . . . . . . . . . . . . . . . . . . . 14 85 6.3.17. V_VP9 . . . . . . . . . . . . . . . . . . . . . . . . 14 86 6.3.18. V_FFV1 . . . . . . . . . . . . . . . . . . . . . . . 14 87 6.4. Audio Codec Mappings . . . . . . . . . . . . . . . . . . 15 88 6.4.1. A_MPEG/L3 . . . . . . . . . . . . . . . . . . . . . . 15 89 6.4.2. A_MPEG/L2 . . . . . . . . . . . . . . . . . . . . . . 15 90 6.4.3. A_MPEG/L1 . . . . . . . . . . . . . . . . . . . . . . 15 91 6.4.4. A_PCM/INT/BIG . . . . . . . . . . . . . . . . . . . . 16 92 6.4.5. A_PCM/INT/LIT . . . . . . . . . . . . . . . . . . . . 16 93 6.4.6. A_PCM/FLOAT/IEEE . . . . . . . . . . . . . . . . . . 16 94 6.4.7. A_MPC . . . . . . . . . . . . . . . . . . . . . . . . 16 95 6.4.8. A_AC3 . . . . . . . . . . . . . . . . . . . . . . . . 17 96 6.4.9. A_AC3/BSID9 . . . . . . . . . . . . . . . . . . . . . 17 97 6.4.10. A_AC3/BSID10 . . . . . . . . . . . . . . . . . . . . 17 98 6.4.11. A_ALAC . . . . . . . . . . . . . . . . . . . . . . . 18 99 6.4.12. A_DTS . . . . . . . . . . . . . . . . . . . . . . . . 18 100 6.4.13. A_DTS/EXPRESS . . . . . . . . . . . . . . . . . . . . 18 101 6.4.14. A_DTS/LOSSLESS . . . . . . . . . . . . . . . . . . . 18 102 6.4.15. A_VORBIS . . . . . . . . . . . . . . . . . . . . . . 19 103 6.4.16. A_FLAC . . . . . . . . . . . . . . . . . . . . . . . 19 104 6.4.17. AREAL/144 . . . . . . . . . . . . . . . . . . . . . . 19 105 6.4.18. AREAL/288 . . . . . . . . . . . . . . . . . . . . . . 19 106 6.4.19. A_REAL/COOK . . . . . . . . . . . . . . . . . . . . . 20 107 6.4.20. A_REAL/SIPR . . . . . . . . . . . . . . . . . . . . . 20 108 6.4.21. A_REAL/RALF . . . . . . . . . . . . . . . . . . . . . 20 109 6.4.22. A_REAL/ATRC . . . . . . . . . . . . . . . . . . . . . 21 110 6.4.23. A_MS/ACM . . . . . . . . . . . . . . . . . . . . . . 21 111 6.4.24. A_AAC/MPEG2/MAIN . . . . . . . . . . . . . . . . . . 21 112 6.4.25. A_AAC/MPEG2/LC . . . . . . . . . . . . . . . . . . . 21 113 6.4.26. A_AAC/MPEG2/LC/SBR . . . . . . . . . . . . . . . . . 22 114 6.4.27. A_AAC/MPEG2/SSR . . . . . . . . . . . . . . . . . . . 22 115 6.4.28. A_AAC/MPEG4/MAIN . . . . . . . . . . . . . . . . . . 22 116 6.4.29. A_AAC/MPEG4/LC . . . . . . . . . . . . . . . . . . . 23 117 6.4.30. A_AAC/MPEG4/LC/SBR . . . . . . . . . . . . . . . . . 23 118 6.4.31. A_AAC/MPEG4/SSR . . . . . . . . . . . . . . . . . . . 23 119 6.4.32. A_AAC/MPEG4/LTP . . . . . . . . . . . . . . . . . . . 23 120 6.4.33. A_QUICKTIME . . . . . . . . . . . . . . . . . . . . . 24 121 6.4.34. A_QUICKTIME/QDMC . . . . . . . . . . . . . . . . . . 24 122 6.4.35. A_QUICKTIME/QDM2 . . . . . . . . . . . . . . . . . . 24 123 6.4.36. A_TTA1 . . . . . . . . . . . . . . . . . . . . . . . 25 124 6.4.37. A_WAVPACK4 . . . . . . . . . . . . . . . . . . . . . 25 125 6.5. Subtitle Codec Mappings . . . . . . . . . . . . . . . . . 26 126 6.5.1. S_TEXT/UTF8 . . . . . . . . . . . . . . . . . . . . . 26 127 6.5.2. S_TEXT/SSA . . . . . . . . . . . . . . . . . . . . . 26 128 6.5.3. S_TEXT/ASS . . . . . . . . . . . . . . . . . . . . . 26 129 6.5.4. S_TEXT/USF . . . . . . . . . . . . . . . . . . . . . 26 130 6.5.5. S_TEXT/WEBVTT . . . . . . . . . . . . . . . . . . . . 26 131 6.5.6. S_IMAGE/BMP . . . . . . . . . . . . . . . . . . . . . 27 132 6.5.7. S_DVBSUB . . . . . . . . . . . . . . . . . . . . . . 27 133 6.5.8. S_VOBSUB . . . . . . . . . . . . . . . . . . . . . . 27 134 6.5.9. S_HDMV/PGS . . . . . . . . . . . . . . . . . . . . . 28 135 6.5.10. S_HDMV/TEXTST . . . . . . . . . . . . . . . . . . . . 28 136 6.5.11. S_KATE . . . . . . . . . . . . . . . . . . . . . . . 28 137 6.6. Button Codec Mappings . . . . . . . . . . . . . . . . . . 28 138 6.6.1. B_VOBBTN . . . . . . . . . . . . . . . . . . . . . . 28 139 7. Subtitles . . . . . . . . . . . . . . . . . . . . . . . . . . 29 140 7.1. Images Subtitles . . . . . . . . . . . . . . . . . . . . 29 141 7.2. SRT Subtitles . . . . . . . . . . . . . . . . . . . . . . 32 142 7.3. SSA/ASS Subtitles . . . . . . . . . . . . . . . . . . . . 33 143 7.4. USF Subtitles . . . . . . . . . . . . . . . . . . . . . . 37 144 7.5. WebVTT . . . . . . . . . . . . . . . . . . . . . . . . . 37 145 7.5.1. Storage of WebVTT in Matroska . . . . . . . . . . . . 37 146 7.5.2. Examples of transformation . . . . . . . . . . . . . 38 147 7.5.3. Storage of WebVTT in Matroska vs. WebM . . . . . . . 41 148 7.6. HDMV presentation graphics subtitles . . . . . . . . . . 42 149 7.6.1. Storage of HDMV presentation graphics 150 subtitles . . . . . . . . . . . . . . . . . . . . . . 42 151 7.7. HDMV text subtitles . . . . . . . . . . . . . . . . . . . 42 152 7.7.1. Storage of HDMV text subtitles . . . . . . . . . . . 42 153 7.8. Digital Video Broadcasting (DVB) subtitles . . . . . . . 43 154 7.8.1. Storage of DVB subtitles . . . . . . . . . . . . . . 44 155 8. Block Additional Mapping . . . . . . . . . . . . . . . . . . 44 156 9. Normative References . . . . . . . . . . . . . . . . . . . . 45 157 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 45 159 1. Introduction 161 Matroska aims to become THE standard of multimedia container formats. 162 It stores interleaved and timestamped audio/video/subtitle data using 163 various codecs. To interpret the codec data, a mapping between the 164 way the data is stored in Matroska and how it is understood by such a 165 codec is necessary. 167 This document intends to define this mapping for many commonly used 168 codecs in Matroska. 170 2. Status of this document 172 This document is a work-in-progress specification defining the 173 Matroska file format as part of the IETF Cellar working group 174 (https://datatracker.ietf.org/wg/cellar/charter/). It uses basic 175 elements and concept already defined in the Matroska specifications 176 defined by this workgroup. 178 3. Security Considerations 180 This document inherits security considerations from the EBML and 181 Matroska documents. 183 4. IANA Considerations 185 To be determined. 187 5. Notations and Conventions 189 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 190 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 191 "OPTIONAL" in this document are to be interpreted as described in BCP 192 14 [RFC2119] [RFC8174] when, and only when, they appear in all 193 capitals, as shown here. 195 6. Codec Mappings 197 A "Codec Mapping" is a set of attributes to identify, name, and 198 contextualize the format and characteristics of encoded data that can 199 be contained within Matroska Clusters. 201 Each TrackEntry used within Matroska MUST reference a defined "Codec 202 Mapping" using the "Codec ID" to identify and describe the format of 203 the encoded data in its associated Clusters. This "Codec ID" is a 204 unique registered identifier that represents the encoding stored 205 within the Track. Certain encodings MAY also require some form of 206 codec initialization in order to provide its decoder with context and 207 technical metadata. 209 The intention behind this list is not to list all existing audio and 210 video codecs, but rather to list those codecs that are currently 211 supported in Matroska and therefore need a well defined "Codec ID" so 212 that all developers supporting Matroska will use the same "Codec ID". 213 If you feel we missed support for a very important codec, please tell 214 us on our development mailing list (cellar at ietf.org). 216 6.1. Defining Matroska Codec Support 218 Support for a codec is defined in Matroska with the following values. 220 6.1.1. Codec ID 222 Each codec supported for storage in Matroska MUST have a unique 223 "Codec ID". Each "Codec ID" MUST be prefixed with the string from 224 the following table according to the associated type of the codec. 225 All characters of a "Codec ID Prefix" MUST be capital letters (A-Z) 226 except for the last character of a "Codec ID Prefix" which MUST be an 227 underscore ("_"). 229 +------------+-----------------+ 230 | Codec Type | Codec ID Prefix | 231 +============+=================+ 232 | Video | "V_" | 233 +------------+-----------------+ 234 | Audio | "A_" | 235 +------------+-----------------+ 236 | Subtitle | "S_" | 237 +------------+-----------------+ 238 | Button | "B_" | 239 +------------+-----------------+ 241 Table 1 243 Each "Codec ID" MUST include a "Major Codec ID" immediately following 244 the "Codec ID Prefix". A "Major Codec ID" MAY be followed by an 245 OPTIONAL "Codec ID Suffix" to communicate a refinement of the "Major 246 Codec ID". If a "Codec ID Suffix" is used, then the "Codec ID" MUST 247 include a forward slash ("/") as a separator between the "Major Codec 248 ID" and the "Codec ID Suffix". The "Major Codec ID" MUST be composed 249 of only capital letters (A-Z) and numbers (0-9). The "Codec ID 250 Suffix" MUST be composed of only capital letters (A-Z), numbers 251 (0-9), underscore ("_"), and forward slash ("/"). 253 The following table provides examples of valid "Codec IDs" and their 254 components: 256 +----------+----------+-----------+-----------+-----------------+ 257 | Codec ID | Major | Separator | Codec ID | Codec ID | 258 | Prefix | Codec ID | | Suffix | | 259 +==========+==========+===========+===========+=================+ 260 | A_ | AAC | / | MPEG2/LC/ | A_AAC/MPEG2/LC/ | 261 | | | | SBR | SBR | 262 +----------+----------+-----------+-----------+-----------------+ 263 | V_ | MPEG4 | / | ISO/ASP | V_MPEG4/ISO/ASP | 264 +----------+----------+-----------+-----------+-----------------+ 265 | V_ | MPEG1 | | | V_MPEG1 | 266 +----------+----------+-----------+-----------+-----------------+ 268 Table 2 270 6.1.2. Codec Name 272 Each encoding supported for storage in Matroska MUST have a "Codec 273 Name". The "Codec Name" provides a readable label for the encoding. 275 6.1.3. Description 277 An optional description for the encoding. This value is only 278 intended for human consumption. 280 6.1.4. Initialization 282 Each encoding supported for storage in Matroska MUST have a defined 283 Initialization. The Initialization MUST describe the storage of data 284 necessary to initialize the decoder, which MUST be stored within the 285 "CodecPrivate Element". When the Initialization is updated within a 286 track then that updated Initialization data MUST be written into the 287 "CodecState Element" of the first "Cluster" to require it. If the 288 encoding does not require any form of Initialization then "none" MUST 289 be used to define the Initialization and the "CodecPrivate Element" 290 SHOULD NOT be written and MUST be ignored. Data that is defined 291 Initialization to be stored in the "CodecPrivate Element" is known as 292 "Private Data". 294 6.1.5. Codec BlockAdditions 296 Additional data that contextualizes or supplements a "Block" can be 297 stored within the "BlockAdditional Element" of a "BlockMore Element". 298 This "BlockAdditional" data MAY be passed to the associated decoder 299 along with the content of the "Block Element". Each 300 "BlockAdditional" is coupled with a "BlockAddID" that identifies the 301 kind of data it contains. The following table defines the meanings 302 of "BlockAddID" values. 304 +------------+-------------------------------------------------+ 305 | BlockAddID | Definition | 306 | Value | | 307 +============+=================================================+ 308 | 0 | Invalid. | 309 +------------+-------------------------------------------------+ 310 | 1 | Indicates that the context of the | 311 | | "BlockAdditional" data is defined by the | 312 | | corresponding "Codec Mapping". | 313 +------------+-------------------------------------------------+ 314 | 2 or | "BlockAddID" values of 2 and greater are mapped | 315 | greater | to the "BlockAddIDValue" of the | 316 | | "BlockAdditionMapping" of the associated Track. | 317 +------------+-------------------------------------------------+ 319 Table 3 321 The values of "BlockAddID" that are 2 of greater have no semantic 322 meaning, but simply associate the "BlockMore Element" with a 323 "BlockAdditionMapping" of the associated Track. See the section on 324 Block Additional Mappings (#block-additional-mapping) for more 325 information. 327 The following XML depicts the nested Elements of a "BlockGroup 328 Element" with an example of BlockAdditions: 330 {Binary data of a VP9 video frame in YUV} 1 {alpha channel encoding to supplement the VP9 frame} 332 6.1.6. Citation 334 Documentation of the associated normative and informative references 335 for the codec is RECOMMENDED. 337 6.1.7. Deprecation Date 339 A timestamp, expressed in [RFC3339] that notes when support for the 340 "Codec Mapping" within Matroska was deprecated. If a "Codec Mapping" 341 is defined with a "Deprecation Date", then it is RECOMMENDED that 342 Matroska writers SHOULD NOT use the "Codec Mapping" after the 343 "Deprecation Date". 345 6.1.8. Superseded By 347 A "Codec Mapping" MAY only be defined with a "Superseded By" value, 348 if it has an expressed "Deprecation Date". If used, the "Superseded 349 By" value MUST store the "Codec ID" of another "Codec Mapping" that 350 has superseded the "Codec Mapping". 352 6.2. Recommendations for the Creation of New Codec Mappings 354 Creators of new "Codec Mappings" to be used in the context of 355 Matroska: 357 * SHOULD assume that all "Codec Mappings" they create might become 358 standardized, public, commonly deployed, or usable across multiple 359 implementations. 361 * SHOULD employ meaningful values for "Codec ID" and "Codec Name" 362 that they have reason to believe are currently unused. 364 * SHOULD NOT prefix their "Codec ID" with "X_" or similar 365 constructs. 367 These recommendations are based upon Section 3 of [RFC6648]. 369 6.3. Video Codec Mappings 370 6.3.1. V_MS/VFW/FOURCC 372 Codec ID: "V_MS/VFW/FOURCC" 374 Codec Name: Microsoft (TM) Video Codec Manager (VCM) 376 Description: The private data contains the VCM structure 377 BITMAPINFOHEADER including the extra private bytes, as defined by 378 Microsoft (https://msdn.microsoft.com/en-us/library/windows/desktop/ 379 dd318229(v=vs.85).aspx). The data are stored in little endian format 380 (like on IA32 machines). Where is the Huffman table stored in 381 HuffYUV, not AVISTREAMINFO ??? And the FourCC, not in 382 AVISTREAMINFO.fccHandler ??? 384 Initialization: "Private Data" contains the VCM structure 385 BITMAPINFOHEADER including the extra private bytes, as defined by 386 Microsoft in https://msdn.microsoft.com/en- 387 us/library/windows/desktop/dd183376(v=vs.85).aspx 388 (https://msdn.microsoft.com/en-us/library/windows/desktop/ 389 dd183376(v=vs.85).aspx). 391 Citation: https://msdn.microsoft.com/en-us/library/windows/desktop/ 392 dd183376(v=vs.85).aspx (https://msdn.microsoft.com/en- 393 us/library/windows/desktop/dd183376(v=vs.85).aspx) 395 6.3.2. V_UNCOMPRESSED 397 Codec ID: V_UNCOMPRESSED 399 Codec Name: Video, raw uncompressed video frames 401 Description: All details about the used color specs and bit depth are 402 to be put/read from the KaxCodecColourSpace elements. 404 Initialization: none 406 6.3.3. V_MPEG4/ISO/SP 408 Codec ID: V_MPEG4/ISO/SP 410 Codec Name: MPEG4 ISO simple profile (DivX4) 412 Description: Stream was created via improved codec API (UCI) or even 413 transmuxed from AVI (no b-frames in Simple Profile), frame order is 414 coding order. 416 Initialization: none 418 6.3.4. V_MPEG4/ISO/ASP 420 Codec ID: V_MPEG4/ISO/ASP 422 Codec Name: MPEG4 ISO advanced simple profile (DivX5, XviD, FFMPEG) 424 Description: Stream was created via improved codec API (UCI) or 425 transmuxed from MP4, not simply transmuxed from AVI. Note there are 426 differences how b-frames are handled in these native streams, when 427 being compared to a VfW created stream, as here there are "no" dummy 428 frames inserted, the frame order is exactly the same as the coding 429 order, same as in MP4 streams. 431 Initialization: none 433 6.3.5. V_MPEG4/ISO/AP 435 Codec ID: V_MPEG4/ISO/AP 437 Codec Name: MPEG4 ISO advanced profile 439 Description: Stream was created via improved codec API (UCI) or 440 transmuxed from MP4, not simply transmuxed from AVI. Note there are 441 differences how b-frames are handled in these native streams, when 442 being compared to a VfW created stream, as here there are "no" dummy 443 frames inserted, the frame order is exactly the same as the coding 444 order, same as in MP4 streams. 446 Initialization: none 448 6.3.6. V_MPEG4/MS/V3 450 Codec ID: V_MPEG4/MS/V3 452 Codec Name: Microsoft (TM) MPEG4 V3 454 Description: Microsoft (TM) MPEG4 V3 and derivates, means DivX3, 455 Angelpotion, SMR, etc.; stream was created using VfW codec or 456 transmuxed from AVI; note that V1/V2 are covered in VfW compatibility 457 mode. 459 Initialization: none 461 6.3.7. V_MPEG1 463 Codec ID: V_MPEG1 465 Codec Name: MPEG 1 466 Description: The Matroska video stream will contain a demuxed 467 Elementary Stream (ES), where block boundaries are still to be 468 defined. Its RECOMMENDED to use MPEG2MKV.exe for creating those 469 files, and to compare the results with self-made implementations 471 Initialization: none 473 6.3.8. V_MPEG2 475 Codec ID: V_MPEG2 477 Codec Name: MPEG 2 479 Description: The Matroska video stream will contain a demuxed 480 Elementary Stream (ES), where block boundaries are still to be 481 defined. Its RECOMMENDED to use MPEG2MKV.exe for creating those 482 files, and to compare the results with self-made implementations 484 Initialization: none 486 6.3.9. V_REAL/RV10 488 Codec ID: V_REAL/RV10 490 Codec Name: RealVideo 1.0 aka RealVideo 5 492 Description: Individual slices from the Real container are combined 493 into a single frame. 495 Initialization: The "Private Data" contains a "real_video_props_t" 496 structure in Big Endian byte order as found in librmff 497 (https://github.com/mbunkus/mkvtoolnix/blob/master/lib/librmff/ 498 librmff.h). 500 6.3.10. V_REAL/RV20 502 Codec ID: V_REAL/RV20 504 Codec Name: RealVideo G2 and RealVideo G2+SVT 506 Description: Individual slices from the Real container are combined 507 into a single frame. 509 Initialization: The "Private Data" contains a "real_video_props_t" 510 structure in Big Endian byte order as found in librmff 511 (https://github.com/mbunkus/mkvtoolnix/blob/master/lib/librmff/ 512 librmff.h). 514 6.3.11. V_REAL/RV30 516 Codec ID: V_REAL/RV30 518 Codec Name: RealVideo 8 520 Description: Individual slices from the Real container are combined 521 into a single frame. 523 Initialization: The "Private Data" contains a "real_video_props_t" 524 structure in Big Endian byte order as found in librmff 525 (https://github.com/mbunkus/mkvtoolnix/blob/master/lib/librmff/ 526 librmff.h). 528 6.3.12. V_REAL/RV40 530 Codec ID: V_REAL/RV40 532 Codec Name: rv40 : RealVideo 9 534 Description: Individual slices from the Real container are combined 535 into a single frame. 537 Initialization: The "Private Data" contains a "real_video_props_t" 538 structure in Big Endian byte order as found in librmff 539 (https://github.com/mbunkus/mkvtoolnix/blob/master/lib/librmff/ 540 librmff.h). 542 6.3.13. V_QUICKTIME 544 Codec ID: V_QUICKTIME 546 Codec Name: Video taken from QuickTime(TM) files 548 Description: Several codecs as stored in QuickTime, e.g. Sorenson or 549 Cinepak. 551 Initialization: The "Private Data" contains all additional data that 552 is stored in the 'stsd' (sample description) atom in the QuickTime 553 file *after* the mandatory video descriptor structure (starting with 554 the size and FourCC fields). For an explanation of the QuickTime 555 file format read QuickTime File Format Specification 556 (https://developer.apple.com/library/mac/documentation/QuickTime/ 557 QTFF/QTFFPreface/qtffPreface.html). 559 6.3.14. V_THEORA 561 Codec ID: V_THEORA 563 Codec Name: Theora 565 Initialization: The "Private Data" contains the first three Theora 566 packets in order. The lengths of the packets precedes them. The 567 actual layout is: 569 * Byte 1: number of distinct packets '"#p"' minus one inside the 570 CodecPrivate block. This MUST be '2' for current (as of 571 2016-07-08) Theora headers. 573 * Bytes 2..n: lengths of the first '"#p"' packets, coded in Xiph- 574 style lacing. The length of the last packet is the length of the 575 CodecPrivate block minus the lengths coded in these bytes minus 576 one. 578 * Bytes n+1..: The Theora identification header, followed by the 579 commend header followed by the codec setup header. Those are 580 described in the Theora specs (http://www.theora.org/doc/ 581 Theora.pdf). 583 6.3.15. V_PRORES 585 Codec ID: V_PRORES 587 Codec Name: Apple ProRes 589 Initialization: The "Private Data" contains the FourCC as found in 590 MP4 movies: 592 * ap4x: ProRes 4444 XQ 594 * ap4h: ProRes 4444 596 * apch: ProRes 422 High Quality 598 * apcn: ProRes 422 Standard Definition 600 * apcs: ProRes 422 LT 602 * apco: ProRes 422 Proxy 604 * aprh: ProRes RAW High Quality 606 * aprn: ProRes RAW Standard Definition 607 this page for more technical details on ProRes 608 (http://wiki.multimedia.cx/index.php?title=Apple_ProRes#Frame_layout) 610 6.3.16. V_VP8 612 Codec ID: V_VP8 614 Codec Name: VP8 Codec format 616 Description: VP8 is an open and royalty free video compression format 617 developed by Google and created by On2 Technologies as a successor to 618 VP7. [RFC6386] 620 Codec BlockAdditions: A single-channel encoding of an alpha channel 621 MAY be stored in "BlockAdditions". The "BlockAddId" of the 622 "BlockMore" containing these data MUST be 1. 624 Initialization: none 626 6.3.17. V_VP9 628 Codec ID: V_VP9 630 Codec Name: VP9 Codec format 632 Description: VP9 is an open and royalty free video compression format 633 developed by Google as a successor to VP8. Draft VP9 Bitstream and 634 Decoding Process Specification (https://www.webmproject.org/vp9/) 636 Codec BlockAdditions: A single-channel encoding of an alpha channel 637 MAY be stored in "BlockAdditions". The "BlockAddId" of the 638 "BlockMore" containing these data MUST be 1. 640 Initialization: none 642 6.3.18. V_FFV1 644 Codec ID: V_FFV1 646 Codec Name: FF Video Codec 1 648 Description: FFV1 is a lossless intra-frame video encoding format 649 designed to efficiently compress video data in a variety of pixel 650 formats. Compared to uncompressed video, FFV1 offers storage 651 compression, frame fixity, and self-description, which makes FFV1 652 useful as a preservation or intermediate video format. Draft FFV1 653 Specification (https://datatracker.ietf.org/doc/draft-ietf-cellar- 654 ffv1/) 655 Initialization: For FFV1 versions 0 or 1, "Private Data" SHOULD NOT 656 be written. For FFV1 version 3 or greater, the "Private Data" MUST 657 contain the FFV1 Configuration Record structure, as defined in 658 https://tools.ietf.org/html/draft-ietf-cellar-ffv1-04#section-4.2 659 (https://tools.ietf.org/html/draft-ietf-cellar-ffv1-04#section-4.2), 660 and no other data. 662 6.4. Audio Codec Mappings 664 6.4.1. A_MPEG/L3 666 Codec ID: A_MPEG/L3 668 Codec Name: MPEG Audio 1, 2, 2.5 Layer III 670 Description: The data contain everything needed for playback in the 671 MPEG Audio header of each frame. Corresponding ACM wFormatTag : 672 0x0055 674 Initialization: none 676 6.4.2. A_MPEG/L2 678 Codec ID: A_MPEG/L2 680 Codec Name: MPEG Audio 1, 2 Layer II 682 Description: The data contain everything needed for playback in the 683 MPEG Audio header of each frame. Corresponding ACM wFormatTag : 684 0x0050 686 Initialization: none 688 6.4.3. A_MPEG/L1 690 Codec ID: A_MPEG/L1 692 Codec Name: MPEG Audio 1, 2 Layer I 694 Description: The data contain everything needed for playback in the 695 MPEG Audio header of each frame. Corresponding ACM wFormatTag : 696 0x0050 698 Initialization: none 700 6.4.4. A_PCM/INT/BIG 702 Codec ID: A_PCM/INT/BIG 704 Codec Name: PCM Integer Big Endian 706 Description: The audio bit depth MUST be read and set from the 707 "BitDepth Element". Audio samples MUST be considered as signed 708 values, except if the audio bit depth is "8" which MUST be 709 interpreted as unsigned values. Corresponding ACM wFormatTag : ??? 711 Initialization: none 713 6.4.5. A_PCM/INT/LIT 715 Codec ID: A_PCM/INT/LIT 717 Codec Name: PCM Integer Little Endian 719 Description: The audio bit depth MUST be read and set from the 720 "BitDepth Element". Audio samples MUST be considered as signed 721 values, except if the audio bit depth is "8" which MUST be 722 interpreted as unsigned values. Corresponding ACM wFormatTag : 723 0x0001 725 Initialization: none 727 6.4.6. A_PCM/FLOAT/IEEE 729 Codec ID: A_PCM/FLOAT/IEEE 731 Codec Name: Floating Point, IEEE compatible 733 Description: The audio bit depth MUST be read and set from the 734 "BitDepth Element" (32 bit in most cases). The floats are stored as 735 defined in [IEEE.754.1985] and in little endian order. Corresponding 736 ACM wFormatTag : 0x0003 738 Initialization: none 740 6.4.7. A_MPC 742 Codec ID: A_MPC 744 Codec Name: MPC (musepack) SV8 746 Description: The main developer for musepack has requested that we 747 wait until the SV8 framing has been fully defined for musepack before 748 defining how to store it in Matroska. 750 6.4.8. A_AC3 752 Codec ID: A_AC3 754 Codec Name: (Dolby[TM]) AC3 756 Description: BSID <= 8 !! The private data is void ??? Corresponding 757 ACM wFormatTag : 0x2000 ; channel number have to be read from the 758 corresponding audio element 760 6.4.9. A_AC3/BSID9 762 Codec ID: A_AC3/BSID9 764 Codec Name: (Dolby[TM]) AC3 766 Description: The ac3 frame header has, similar to the mpeg-audio 767 header a version field. Normal ac3 is defined as bitstream id 8 (5 768 Bits, numbers are 0-15). Everything below 8 is still compatible with 769 all decoders that handle 8 correctly. Everything higher are 770 additions that break decoder compatibility. For the samplerates 771 24kHz (00); 22,05kHz (01) and 16kHz (10) the BSID is 9 For the 772 samplerates 12kHz (00); 11,025kHz (01) and 8kHz (10) the BSID is 10 774 Initialization: none 776 6.4.10. A_AC3/BSID10 778 Codec ID: A_AC3/BSID10 780 Codec Name: (Dolby[TM]) AC3 782 Description: The ac3 frame header has, similar to the mpeg-audio 783 header a version field. Normal ac3 is defined as bitstream id 8 (5 784 Bits, numbers are 0-15). Everything below 8 is still compatible with 785 all decoders that handle 8 correctly. Everything higher are 786 additions that break decoder compatibility. For the samplerates 787 24kHz (00); 22,05kHz (01) and 16kHz (10) the BSID is 9 For the 788 samplerates 12kHz (00); 11,025kHz (01) and 8kHz (10) the BSID is 10 790 Initialization: none 792 6.4.11. A_ALAC 794 Codec ID: A_ALAC 796 Codec Name: ALAC (Apple Lossless Audio Codec) 798 Initialization: The "Private Data" contains ALAC's magic cookie (both 799 the codec specific configuration as well as the optional channel 800 layout information). Its format is described in ALAC's official 801 source code (http://alac.macosforge.org/trac/browser/trunk/ 802 ALACMagicCookieDescription.txt). 804 6.4.12. A_DTS 806 Codec ID: A_DTS 808 Codec Name: Digital Theatre System 810 Description: Supports DTS, DTS-ES, DTS-96/26, DTS-HD High Resolution 811 Audio and DTS-HD Master Audio. The private data is void. 812 Corresponding ACM wFormatTag : 0x2001 814 Initialization: none 816 6.4.13. A_DTS/EXPRESS 818 Codec ID: A_DTS/EXPRESS 820 Codec Name: Digital Theatre System Express 822 Description: DTS Express (a.k.a. LBR) audio streams. The private 823 data is void. Corresponding ACM wFormatTag : 0x2001 825 Initialization: none 827 6.4.14. A_DTS/LOSSLESS 829 Codec ID: A_DTS/LOSSLESS 831 Codec Name: Digital Theatre System Lossless 833 Description: DTS Lossless audio that does not have a core substream. 834 The private data is void. Corresponding ACM wFormatTag : 0x2001 836 Initialization: none 838 6.4.15. A_VORBIS 840 Codec ID: A_VORBIS 842 Codec Name: Vorbis 844 Initialization: The "Private Data" contains the first three Vorbis 845 packet in order. The lengths of the packets precedes them. The 846 actual layout is: - Byte 1: number of distinct packets '"#p"' minus 847 one inside the CodecPrivate block. This MUST be '2' for current (as 848 of 2016-07-08) Vorbis headers. - Bytes 2..n: lengths of the first 849 '"#p"' packets, coded in Xiph-style lacing. The length of the last 850 packet is the length of the CodecPrivate block minus the lengths 851 coded in these bytes minus one. - Bytes n+1..: The Vorbis 852 identification header (https://xiph.org/vorbis/doc/ 853 Vorbis_I_spec.html), followed by the Vorbis comment header 854 (https://xiph.org/vorbis/doc/v-comment.html) followed by the codec 855 setup header (https://xiph.org/vorbis/doc/Vorbis_I_spec.html). 857 6.4.16. A_FLAC 859 Codec ID: A_FLAC 861 Codec Name: FLAC (Free Lossless Audio Codec) 862 (http://flac.sourceforge.net/) 864 Initialization: The "Private Data" contains all the header/metadata 865 packets before the first data packet. These include the first header 866 packet containing only the word "fLaC" as well as all metadata 867 packets. 869 6.4.17. A_REAL/14_4 871 Codec ID: A_REAL/14_4 873 Codec Name: Real Audio 1 875 Initialization: The "Private Data" contains either the 876 "real_audio_v4_props_t" or the "real_audio_v5_props_t" structure 877 (differentiated by their "version" field; Big Endian byte order) as 878 found in librmff 879 (https://github.com/mbunkus/mkvtoolnix/blob/master/lib/librmff/ 880 librmff.h). 882 6.4.18. A_REAL/28_8 884 Codec ID: A_REAL/28_8 885 Codec Name: Real Audio 2 887 Initialization: The "Private Data" contains either the 888 "real_audio_v4_props_t" or the "real_audio_v5_props_t" structure 889 (differentiated by their "version" field; Big Endian byte order) as 890 found in librmff 891 (https://github.com/mbunkus/mkvtoolnix/blob/master/lib/librmff/ 892 librmff.h). 894 6.4.19. A_REAL/COOK 896 Codec ID: A_REAL/COOK 898 Codec Name: Real Audio Cook Codec (codename: Gecko) 900 Initialization: The "Private Data" contains either the 901 "real_audio_v4_props_t" or the "real_audio_v5_props_t" structure 902 (differentiated by their "version" field; Big Endian byte order) as 903 found in librmff 904 (https://github.com/mbunkus/mkvtoolnix/blob/master/lib/librmff/ 905 librmff.h). 907 6.4.20. A_REAL/SIPR 909 Codec ID: A_REAL/SIPR 911 Codec Name: Sipro Voice Codec 913 Initialization: The "Private Data" contains either the 914 "real_audio_v4_props_t" or the "real_audio_v5_props_t" structure 915 (differentiated by their "version" field; Big Endian byte order) as 916 found in librmff 917 (https://github.com/mbunkus/mkvtoolnix/blob/master/lib/librmff/ 918 librmff.h). 920 6.4.21. A_REAL/RALF 922 Codec ID: A_REAL/RALF 924 Codec Name: Real Audio Lossless Format 926 Initialization: The "Private Data" contains either the 927 "real_audio_v4_props_t" or the "real_audio_v5_props_t" structure 928 (differentiated by their "version" field; Big Endian byte order) as 929 found in librmff 930 (https://github.com/mbunkus/mkvtoolnix/blob/master/lib/librmff/ 931 librmff.h). 933 6.4.22. A_REAL/ATRC 935 Codec ID: A_REAL/ATRC 937 Codec Name: Sony Atrac3 Codec 939 Initialization: The "Private Data" contains either the 940 "real_audio_v4_props_t" or the "real_audio_v5_props_t" structure 941 (differentiated by their "version" field; Big Endian byte order) as 942 found in librmff 943 (https://github.com/mbunkus/mkvtoolnix/blob/master/lib/librmff/ 944 librmff.h). 946 6.4.23. A_MS/ACM 948 Codec ID: A_MS/ACM 950 Codec Name: Microsoft(TM) Audio Codec Manager (ACM) 952 Description: The data are stored in little endian format (like on 953 IA32 machines). 955 Initialization: The "Private Data" contains the ACM structure 956 WAVEFORMATEX including the extra private bytes, as defined by 957 Microsoft 958 (http://msdn.microsoft.com/library/default.asp?url=/library/en- 959 us/multimed/mmstr_625u.asp). 961 6.4.24. A_AAC/MPEG2/MAIN 963 Codec ID: A_AAC/MPEG2/MAIN 965 Codec Name: MPEG2 Main Profile 967 Description: Channel number and sample rate have to be read from the 968 corresponding audio element. Audio stream is stripped from ADTS 969 headers and normal Matroska frame based muxing scheme is applied. 970 AAC audio always uses wFormatTag 0xFF. 972 Initialization: none 974 6.4.25. A_AAC/MPEG2/LC 976 Codec ID: A_AAC/MPEG2/LC 978 Codec Name: Low Complexity 979 Description: Channel number and sample rate have to be read from the 980 corresponding audio element. Audio stream is stripped from ADTS 981 headers and normal Matroska frame based muxing scheme is applied. 982 AAC audio always uses wFormatTag 0xFF. 984 Initialization: none 986 6.4.26. A_AAC/MPEG2/LC/SBR 988 Codec ID: A_AAC/MPEG2/LC/SBR 990 Codec Name: Low Complexity with Spectral Band Replication 992 Description: Channel number and sample rate have to be read from the 993 corresponding audio element. Audio stream is stripped from ADTS 994 headers and normal Matroska frame based muxing scheme is applied. 995 AAC audio always uses wFormatTag 0xFF. 997 Initialization: none 999 6.4.27. A_AAC/MPEG2/SSR 1001 Codec ID: A_AAC/MPEG2/SSR 1003 Codec Name: Scalable Sampling Rate 1005 Description: Channel number and sample rate have to be read from the 1006 corresponding audio element. Audio stream is stripped from ADTS 1007 headers and normal Matroska frame based muxing scheme is applied. 1008 AAC audio always uses wFormatTag 0xFF. 1010 Initialization: none 1012 6.4.28. A_AAC/MPEG4/MAIN 1014 Codec ID: A_AAC/MPEG4/MAIN 1016 Codec Name: MPEG4 Main Profile 1018 Description: Channel number and sample rate have to be read from the 1019 corresponding audio element. Audio stream is stripped from ADTS 1020 headers and normal Matroska frame based muxing scheme is applied. 1021 AAC audio always uses wFormatTag 0xFF. 1023 Initialization: none 1025 6.4.29. A_AAC/MPEG4/LC 1027 Codec ID: A_AAC/MPEG4/LC 1029 Codec Name: Low Complexity 1031 Description: Channel number and sample rate have to be read from the 1032 corresponding audio element. Audio stream is stripped from ADTS 1033 headers and normal Matroska frame based muxing scheme is applied. 1034 AAC audio always uses wFormatTag 0xFF. 1036 Initialization: none 1038 6.4.30. A_AAC/MPEG4/LC/SBR 1040 Codec ID: A_AAC/MPEG4/LC/SBR 1042 Codec Name: Low Complexity with Spectral Band Replication 1044 Description: Channel number and sample rate have to be read from the 1045 corresponding audio element. Audio stream is stripped from ADTS 1046 headers and normal Matroska frame based muxing scheme is applied. 1047 AAC audio always uses wFormatTag 0xFF. 1049 Initialization: none 1051 6.4.31. A_AAC/MPEG4/SSR 1053 Codec ID: A_AAC/MPEG4/SSR 1055 Codec Name: Scalable Sampling Rate 1057 Description: Channel number and sample rate have to be read from the 1058 corresponding audio element. Audio stream is stripped from ADTS 1059 headers and normal Matroska frame based muxing scheme is applied. 1060 AAC audio always uses wFormatTag 0xFF. 1062 Initialization: none 1064 6.4.32. A_AAC/MPEG4/LTP 1066 Codec ID: A_AAC/MPEG4/LTP 1068 Codec Name: Long Term Prediction 1070 Description: Channel number and sample rate have to be read from the 1071 corresponding audio element. Audio stream is stripped from ADTS 1072 headers and normal Matroska frame based muxing scheme is applied. 1073 AAC audio always uses wFormatTag 0xFF. 1075 Initialization: none 1077 6.4.33. A_QUICKTIME 1079 Codec ID: A_QUICKTIME 1081 Codec Name: Audio taken from QuickTime(TM) files 1083 Description: Several codecs as stored in QuickTime, e.g. QDesign 1084 Music v1 or v2. 1086 Initialization: The "Private Data" contains all additional data that 1087 is stored in the 'stsd' (sample description) atom in the QuickTime 1088 file *after* the mandatory sound descriptor structure (starting with 1089 the size and FourCC fields). For an explanation of the QuickTime 1090 file format read QuickTime File Format Specification 1091 (https://developer.apple.com/library/mac/documentation/QuickTime/ 1092 QTFF/QTFFPreface/qtffPreface.html). 1094 6.4.34. A_QUICKTIME/QDMC 1096 Codec ID: A_QUICKTIME/QDMC 1098 Codec Name: QDesign Music 1100 Description: 1102 Initialization: The "Private Data" contains all additional data that 1103 is stored in the 'stsd' (sample description) atom in the QuickTime 1104 file *after* the mandatory sound descriptor structure (starting with 1105 the size and FourCC fields). For an explanation of the QuickTime 1106 file format read QuickTime File Format Specification 1107 (https://developer.apple.com/library/mac/documentation/QuickTime/ 1108 QTFF/QTFFPreface/qtffPreface.html). 1110 Superseded By: A_QUICKTIME 1112 6.4.35. A_QUICKTIME/QDM2 1114 Codec ID: A_QUICKTIME/QDM2 1116 Codec Name: QDesign Music v2 1118 Description: 1120 Initialization: The "Private Data" contains all additional data that 1121 is stored in the 'stsd' (sample description) atom in the QuickTime 1122 file *after* the mandatory sound descriptor structure (starting with 1123 the size and FourCC fields). For an explanation of the QuickTime 1124 file format read QuickTime File Format Specification 1125 (https://developer.apple.com/library/mac/documentation/QuickTime/ 1126 QTFF/QTFFPreface/qtffPreface.html). 1128 Superseded By: A_QUICKTIME 1130 6.4.36. A_TTA1 1132 Codec ID: A_TTA1 1134 Codec Name: The True Audio (http://tausoft.org/) lossless audio 1135 compressor 1137 Description: TTA format description (http://tausoft.org/wiki/ 1138 True_Audio_Codec_Format) Each frame is kept intact, including the 1139 CRC32. The header and seektable are dropped. SamplingFrequency, 1140 Channels and BitDepth are used in the TrackEntry. wFormatTag = 0x77A1 1142 Initialization: none 1144 6.4.37. A_WAVPACK4 1146 Codec ID: A_WAVPACK4 1148 Codec Name: WavPack (http://www.wavpack.com/) lossless audio 1149 compressor 1151 Description: The Wavpack packets consist of a stripped header 1152 followed by the frame data. For multi-track (> 2 tracks) a frame 1153 consists of many packets. For more details, check the WavPack muxing 1154 description (wavpack.html). 1156 Codec BlockAdditions: For hybrid "A_WAVPACK4" encodings (that include 1157 a lossy encoding with a supplemental correction to produce a lossless 1158 encoding), the correction part is stored in BlockAdditional. The 1159 "BlockAddId" of the "BlockMore" containing these data MUST be 1. 1161 Initialization: none 1163 6.5. Subtitle Codec Mappings 1165 6.5.1. S_TEXT/UTF8 1167 Codec ID: S_TEXT/UTF8 1169 Codec Name: UTF-8 Plain Text 1171 Description: Basic text subtitles. For more information, please look 1172 at the Subtitles section (#subtitles). 1174 6.5.2. S_TEXT/SSA 1176 Codec ID: S_TEXT/SSA 1178 Codec Name: Subtitles Format 1180 Description: The [Script Info] and [V4 Styles] sections are stored in 1181 the codecprivate. Each event is stored in its own Block. For more 1182 information, see the SSA/ASS section in Subtitles (#subtitles). 1184 6.5.3. S_TEXT/ASS 1186 Codec ID: S_TEXT/ASS 1188 Codec Name: Advanced Subtitles Format 1190 Description: The [Script Info] and [V4 Styles] sections are stored in 1191 the codecprivate. Each event is stored in its own Block. For more 1192 information, see the SSA/ASS section in Subtitles (#subtitles). 1194 6.5.4. S_TEXT/USF 1196 Codec ID: S_TEXT/USF 1198 Codec Name: Universal Subtitle Format 1200 Description: This is mostly defined, but not typed out yet. It will 1201 first be available on the USF specification in Subtitles 1202 (#subtitles). 1204 6.5.5. S_TEXT/WEBVTT 1206 Codec ID: S_TEXT/WEBVTT 1208 Codec Name: Web Video Text Tracks Format (WebVTT) 1209 Description: Advanced text subtitles. For more information, see the 1210 WebVTT section in Subtitles (#subtitles). 1212 6.5.6. S_IMAGE/BMP 1214 Codec ID: S_IMAGE/BMP 1216 Codec Name: Bitmap 1218 Description: Basic image based subtitle format; The subtitles are 1219 stored as images, like in the DVD. The timestamp in the block header 1220 of Matroska indicates the start display time, the duration is set 1221 with the Duration element. The full data for the subtitle bitmap is 1222 stored in the Block's data section. 1224 6.5.7. S_DVBSUB 1226 Codec ID: S_DVBSUB 1228 Codec Name: Digital Video Broadcasting (DVB) subtitles 1230 Description: This is the graphical subtitle format used in the 1231 Digital Video Broadcasting standard. For more information, see the 1232 Digital Video Broadcasting (DVB) section in Subtitles (#subtitles). 1234 6.5.8. S_VOBSUB 1236 Codec ID: S_VOBSUB 1238 Codec Name: VobSub subtitles 1240 Description: The same subtitle format used on DVDs. Supported is 1241 only format version 7 and newer. VobSubs consist of two files, the 1242 .idx containing information, and the .sub, containing the actual 1243 data. The .idx file is stripped of all empty lines, of all comments 1244 and of lines beginning with "alt:" or "langidx:". The line beginning 1245 with "id:" SHOULD be transformed into the appropriate Matroska track 1246 language element and is discarded. All remaining lines but the ones 1247 containing timestamps and file positions are put into the 1248 "CodecPrivate" element. 1250 For each line containing the timestamp and file position data is read 1251 from the appropriate position in the .sub file. This data consists 1252 of a MPEG program stream which in turn contains SPU packets. The 1253 MPEG program stream data is discarded, and each SPU packet is put 1254 into one Matroska frame. 1256 6.5.9. S_HDMV/PGS 1258 Codec ID: S_HDMV/PGS 1260 Codec Name: HDMV presentation graphics subtitles (PGS) 1262 Description: This is the graphical subtitle format used on Blu-rays. 1263 For more information, see HDMV text presentation in Subtitles 1264 (#subtitles). 1266 6.5.10. S_HDMV/TEXTST 1268 Codec ID: S_HDMV/TEXTST 1270 Codec Name: HDMV text subtitles 1272 Description: This is the textual subtitle format used on Blu-rays. 1273 For more information, see HDMV graphics presentation in Subtitles 1274 (#subtitles). 1276 6.5.11. S_KATE 1278 Codec ID: S_KATE 1280 Codec Name: Karaoke And Text Encapsulation 1282 Description: A subtitle format developed for ogg. The mapping for 1283 Matroska is described on the Xiph wiki 1284 (http://wiki.xiph.org/index.php/OggKate#Matroska_mapping). As for 1285 Theora and Vorbis, Kate headers are stored in the private data as 1286 xiph-laced packets. 1288 6.6. Button Codec Mappings 1290 6.6.1. B_VOBBTN 1292 Codec ID: B_VOBBTN 1294 Codec Name: VobBtn Buttons 1296 Description: Based on MPEG/VOB PCI packets 1297 (http://dvd.sourceforge.net/dvdinfo/pci_pkt.html). The file contains 1298 a header consisting of the string "butonDVD" followed by the width 1299 and height in pixels (16 bits integer each) and 4 reserved bytes. 1300 The rest is full PCI packets (http://dvd.sourceforge.net/dvdinfo/ 1301 pci_pkt.html). 1303 7. Subtitles 1305 Because Matroska is a general container format, we try to avoid 1306 specifying the formats to store in it. This type of work is really 1307 outside of the scope of a container-only format. However, because 1308 the use of subtitles in A/V containers has been so limited (with the 1309 exception of DVD) we are taking the time to specify how to store some 1310 of the more common subtitle formats in Matroska. This is being done 1311 to help facilitate their growth. Otherwise, incompatibilities could 1312 prevent the standardization and use of subtitle storage. 1314 This page is not meant to be a complete listing of all subtitle 1315 formats that will be used in Matroska, it is only meant to be a guide 1316 for the more common, current formats. It is possible that we will 1317 add future formats to this page as they are created, but it is not 1318 likely as any other new subtitle format designer would likely have 1319 their own specifications. Any specification listed here SHOULD be 1320 strictly adhered to or it SHOULD NOT use the corresponding Codec ID. 1322 Here is a list of pointers for storing subtitles in Matroska: 1324 * Any Matroska file containing only subtitles SHOULD use the 1325 extension ".mks". 1327 * As a general rule of thumb for all codecs, information that is 1328 global to an entire stream SHOULD be stored in the CodecPrivate 1329 element. 1331 * Start and stop timestamps that are used in a timestamps native 1332 storage format SHOULD be removed when being placed in Matroska as 1333 they could interfere if the file is edited afterwards. Instead, 1334 the Blocks timestamp and Duration SHOULD be used to say when the 1335 timestamp is displayed. 1337 * Because a "subtitle" stream is actually just an overlay stream, 1338 anything with a transparency layer could be use, including video. 1340 7.1. Images Subtitles 1342 The first image format that is a goal to import into Matroska is the 1343 VobSub subtitle format. This subtitle type is generated by exporting 1344 the subtitles from a DVD. 1346 The requirement for muxing VobSub into Matroska is v7 subtitles (see 1347 first line of the .IDX file). If the version is smaller, you must 1348 remux them using the SubResync utility from VobSub 2.23 (or MPC) into 1349 v7 format. Generally any newly created subs will be in v7 format. 1351 The .IFO file will not be used at all. 1353 If there is more than one subtitle stream in the VobSub set, each 1354 stream will need to be separated into separate tracks for storage in 1355 Matroska. E.g. the VobSub file contains streams for both English and 1356 German subtitles. Then the resulting Matroska file SHOULD contain 1357 two tracks. That way the language information can be 'dropped' and 1358 mapped to Matroska's language tags. 1360 The .IDX file is reformatted (see below) and placed in the 1361 CodecPrivate. 1363 Each .BMP will be stored in its own Block. The Timestamp with be 1364 stored in the Blocks Timestamp and the duration will be stored in the 1365 Default Duration. 1367 Here is an example .IDX file: 1369 # VobSub index file, v7 (do not modify this line!) 1370 # 1371 # To repair desynchronization, you can insert gaps this way: 1372 # (it usually happens after vob id changes) 1373 # 1374 # delay: [sign]hh:mm:ss:ms 1375 # 1376 # Where: 1377 # [sign]: +, - (optional) 1378 # hh: hours (0 <= hh) 1379 # mm/ss: minutes/seconds (0 <= mm/ss <= 59) 1380 # ms: milliseconds (0 <= ms <= 999) 1381 # 1382 # Note: You can't position a sub before the previous with a negative 1383 # value. 1384 # 1385 # You can also modify timestamps or delete a few subs you don't 1386 # like. Just make sure they stay in increasing order. 1388 # Settings 1390 # Original frame size 1391 size: 720x480 1393 # Origin, relative to the upper-left corner, can be overloaded by 1394 # alignment 1395 org: 0, 0 1397 # Image scaling (hor,ver), origin is at the upper-left corner or at 1398 # the alignment coord (x, y) 1399 scale: 100%, 100% 1401 # Alpha blending 1402 alpha: 100% 1404 # Smoothing for very blocky images (use OLD for no filtering) 1405 smooth: OFF 1407 # In millisecs 1408 fadein/out: 50, 50 1410 # Force subtitle placement relative to (org.x, org.y) 1411 align: OFF at LEFT TOP 1413 # For correcting non-progressive desync. (in millisecs or 1414 # hh:mm:ss:ms) 1415 # Note: Not effective in DirectVobSub, use "delay: ... " instead. 1416 time offset: 0 1418 # ON: displays only forced subtitles, OFF: shows everything 1419 forced subs: OFF 1421 # The original palette of the DVD 1422 palette: 000000, 7e7e7e, fbff8b, cb86f1, 7f74b8, e23f06, 0a48ea, \ 1423 b3d65a, 6b92f1, 87f087, c02081, f8d0f4, e3c411, 382201, e8840b, \ 1424 fdfdfd 1426 # Custom colors (transp idxs and the four colors) 1427 custom colors: OFF, tridx: 0000, colors: 000000, 000000, 000000, \ 1428 000000 1430 # Language index in use 1431 langidx: 0 1433 # English 1434 id: en, index: 0 1435 # Uncomment next line to activate alternative name in DirectVobSub / 1436 # Windows Media Player 6.x 1437 # alt: English 1438 # Vob/Cell ID: 1, 1 (PTS: 0) 1439 timestamp: 00:00:01:101, filepos: 000000000 1440 timestamp: 00:00:08:708, filepos: 000001000 1442 First, lines beginning with "#" are removed. These are comments to 1443 make text file editing easier, and as this is not a text file, they 1444 aren't needed. 1446 Next remove the "langidx" and "id" lines. These are used to 1447 differentiate the subtitle streams and define the language. As the 1448 streams will be stored separately anyway, there is no need to 1449 differentiate them here. Also, the language setting will be stored 1450 in the Matroska tags, so there is no need to store it here. 1452 Finally, the "timestamp" will be used to set the Block's timestamp. 1453 Once it is set there, there is no need for it to be stored here. 1454 Also, as it may interfere if the file is edited, it SHOULD NOT be 1455 stored here. 1457 Once all of these items are removed, the data to store in the 1458 CodecPrivate SHOULD look like this: 1460 size: 720x480 1461 org: 0, 0 1462 scale: 100%, 100% 1463 alpha: 100% 1464 smooth: OFF 1465 fadein/out: 50, 50 1466 align: OFF at LEFT TOP 1467 time offset: 0 1468 forced subs: OFF 1469 palette: 000000, 7e7e7e, fbff8b, cb86f1, 7f74b8, e23f06, 0a48ea, \ 1470 b3d65a, 6b92f1, 87f087, c02081, f8d0f4, e3c411, 382201, e8840b, \ 1471 fdfdfd 1472 custom colors: OFF, tridx: 0000, colors: 000000, 000000, 000000, \ 1473 000000 1475 There SHOULD also be two Blocks containing one image each with the 1476 timestamps "00:00:01:101" and "00:00:08:708". 1478 7.2. SRT Subtitles 1480 SRT is perhaps the most basic of all subtitle formats. 1482 It consists of four parts, all in text.. 1484 1. A number indicating which subtitle it is in the sequence. 2. 1485 The time that the subtitle appears on the screen, and then 1486 disappears. 3. The subtitle itself. 4. A blank line indicating 1487 the start of a new subtitle. 1489 When placing SRT in Matroska, part 3 is converted to UTF-8 (S_TEXT/ 1490 UTF8) and placed in the data portion of the Block. Part 2 is used to 1491 set the timestamp of the Block, and BlockDuration element. Nothing 1492 else is used. 1494 Here is an example SRT file: 1496 1 1497 00:02:17,440 --> 00:02:20,375 1498 Senator, we're making 1499 our final approach into Coruscant. 1501 2 1502 00:02:20,476 --> 00:02:22,501 1503 Very good, Lieutenant. 1505 In this example, the text "Senator, we're making our final approach 1506 into Coruscant." would be converted into UTF-8 and placed in the 1507 Block. The timestamp of the block would be set to "00:02:17,440". 1508 And the BlockDuration element would be set to "00:00:02,935". 1510 The same is repeated for the next subtitle. 1512 Because there are no general settings for SRT, the CodecPrivate is 1513 left blank. 1515 7.3. SSA/ASS Subtitles 1517 SSA stands for Sub Station Alpha. It's the file format used by the 1518 popular subtitle editor, SubStation Alpha (http://wiki.multimedia.cx/ 1519 index.php?title=SubStation_Alpha). This format is widely used by 1520 fansubbers. 1522 It allows you to do some advanced display features, like positioning, 1523 karaoke, style managements... 1525 For detailed information on SSA/ASS, see the SSA specs 1526 (http://moodub.free.fr/video/ass-specs.doc). It includes an SSA 1527 specs description and the advanced features added by ASS format 1528 (standing for Advanced SSA). Because SSA and ASS are so similar, 1529 they are treated the same here. 1531 Like SRT, this format is text based with a particular syntax. 1533 A file consists of 4 or 5 parts, declared ala INI file (but it's not 1534 an INI !) 1536 The first, "[Script Info]" contains some information about the 1537 subtitle file, such as it's title, who created it, type of script and 1538 a very important one : "PlayResY". Be careful of this value, 1539 everything in your script (font size, positioning) is scaled by it. 1540 Sub Station Alpha uses your desktops Y resolution to write this 1541 value, so if a friend with a large monitor and a high screen 1542 resolution gives you an edited script, you can mess everything up by 1543 saving the script in SSA with your low-cost monitor. 1545 The second, "[V4 Styles]", is a list of style definitions. A style 1546 describe how will look a text on the screen. It defines font, font 1547 size, primary/.../outile colour, position, alignment, etc. 1549 For example this : 1551 Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, \ 1552 TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, \ 1553 Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding 1554 Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,\ 1555 0,1,1,2,2,5,5,30,0,0 1557 The third, "[Events]", is the list of text you want to display at the 1558 right timing. You can specify some attribute here. Like the style 1559 to use for this event (MUST be defined in the list), the position of 1560 the text (Left, Right, Vertical Margin), an effect. Name is mostly 1561 used by translator to know who said this sentence. Timing is in 1562 h:mm:ss.cc (centisec). 1564 Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, \ 1565 Effect, Text 1566 Dialogue: Marked=0,0:02:40.65,0:02:41.79,Wolf main,Cher,0000,0000,\ 1567 0000,,Et les enregistrements de ses ondes delta ? 1568 Dialogue: Marked=0,0:02:42.42,0:02:44.15,Wolf main,autre,0000,0000,\ 1569 0000,,Toujours rien. 1571 "[Pictures]" or "[Fonts]" part can be found in some SSA file, they 1572 contains UUE-encoded pictures/font but those features are only used 1573 by Sub Station Alpha, i.e. no filter (Vobsub/Avery Lee Subtiler 1574 filter) use them. 1576 Now, how are they stored in Matroska ? 1578 * All text is converted to UTF-8* All the headers are stored in 1579 CodecPrivate ( Script Info and the Styles list)* Start & End field 1580 are used to set TimeStamp and the BlockDuration element. the data 1581 stored is :* Events are stored in the Block in this order: 1582 ReadOrder, Layer, Style, Name, MarginL, MarginR, MarginV, Effect, 1583 Text (Layer comes from ASS specs ... it's empty for SSA.) 1584 "ReadOrder field is needed for the decoder to be able to reorder 1585 the streamed samples as they were placed originally in the file." 1587 Here is an example of an SSA file. 1589 [Script Info] 1590 ; This is a Sub Station Alpha v4 script. 1591 ; For Sub Station Alpha info and downloads, 1592 ; go to \ 1593 ; [http://www.eswat.demon.co.uk/](http://www.eswat.demon.co.uk/) 1594 ; or email \ 1595 ; [kotus@eswat.demon.co.uk](mailto:kotus@eswat.demon.co.uk) 1596 Title: Wolf's rain 2 1597 Original Script: Anime-spirit Ishin-francais 1598 Original Translation: Coolman 1599 Original Editing: Spikewolfwood 1600 Original Timing: Lord_alucard 1601 Original Script Checking: Spikewolfwood 1602 ScriptType: v4.00 1603 Collisions: Normal 1604 PlayResY: 1024 1605 PlayDepth: 0 1606 Wav: 0, 128697,D:\Alex\Anime\- Fansub -\- TAFF -\WR_-_02_Wav.wav 1607 Wav: 0, 120692,H:\team truc\WR_-_02.wav 1608 Wav: 0, 116504,E:\sub\wolf's_rain\WOLF'S RAIN 02.wav 1609 LastWav: 3 1610 Timer: 100,0000 1612 [V4 Styles] 1613 Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, \ 1614 TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, \ 1615 Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding 1616 Style: Default,Arial,20,65535,65535,65535,-2147483640,-1,0,1,3,0,2,\ 1617 30,30,30,0,0 1618 Style: Titre_episode,Akbar,140,15724527,65535,65535,986895,-1,0,1,1,\ 1619 0,3,30,30,30,0,0 1620 Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,\ 1621 0,1,1,2,2,5,5,30,0,0 1623 [Events] 1624 Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, \ 1625 Effect, Text 1626 Dialogue: Marked=0,0:02:40.65,0:02:41.79,Wolf main,Cher,0000,0000,\ 1627 0000,,Et les enregistrements de ses ondes delta ? 1628 Dialogue: Marked=0,0:02:42.42,0:02:44.15,Wolf main,autre,0000,0000,\ 1629 0000,,Toujours rien. 1631 Here is what would be placed into the CodecPrivate element. 1633 [Script Info] 1634 ; This is a Sub Station Alpha v4 script. 1635 ; For Sub Station Alpha info and downloads, 1636 ; go to \ 1637 ; [http://www.eswat.demon.co.uk/](http://www.eswat.demon.co.uk/) 1638 ; or email \ 1639 ; [kotus@eswat.demon.co.uk](mailto:kotus@eswat.demon.co.uk) 1640 Title: Wolf's rain 2 1641 Original Script: Anime-spirit Ishin-francais 1642 Original Translation: Coolman 1643 Original Editing: Spikewolfwood 1644 Original Timing: Lord_alucard 1645 Original Script Checking: Spikewolfwood 1646 ScriptType: v4.00 1647 Collisions: Normal 1648 PlayResY: 1024 1649 PlayDepth: 0 1650 Wav: 0, 128697,D:\Alex\Anime\- Fansub -\- TAFF -\WR_-_02_Wav.wav 1651 Wav: 0, 120692,H:\team truc\WR_-_02.wav 1652 Wav: 0, 116504,E:\sub\wolf's_rain\WOLF'S RAIN 02.wav 1653 LastWav: 3 1654 Timer: 100,0000 1656 [V4 Styles] 1657 Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, \ 1658 TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, \ 1659 Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding 1660 Style: Default,Arial,20,65535,65535,65535,-2147483640,-1,0,1,3,0,2,\ 1661 30,30,30,0,0 1662 Style: Titre_episode,Akbar,140,15724527,65535,65535,986895,-1,0,1,1,\ 1663 0,3,30,30,30,0,0 1664 Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,\ 1665 0,1,1,2,2,5,5,30,0,0 1667 And here are the two blocks that would be generated. 1669 Block's timestamp: 00:02:40.650 BlockDuration: 00:00:01.140 1671 1,,Wolf main,Cher,0000,0000,0000,,Et les enregistrements de ses \ 1672 ondes delta ? 1674 Block's timestamp: 00:02:42.420 BlockDuration: 00:00:01.730 1676 2,,Wolf main,autre,0000,0000,0000,,Toujours rien. 1678 7.4. USF Subtitles 1680 Under construction 1682 7.5. WebVTT 1684 The "Web Video Text Tracks Format" (short: WebVTT) is developed by 1685 the World Wide Web Consortium (W3C) (https://www.w3.org/). Its 1686 specifications are freely available (https://w3c.github.io/webvtt/). 1688 The guiding principles for the storage of WebVTT in Matroska are: 1690 * Consistency: store data in a similar way to other subtitle codecs 1692 * Simplicity: making decoding and remuxing as easy as possible for 1693 existing infrastructures 1695 * Completeness: keeping as much data as possible from the original 1696 WebVTT file 1698 7.5.1. Storage of WebVTT in Matroska 1700 7.5.1.1. CodecID: codec identification 1702 The CodecID to use is "S_TEXT/WEBVTT". 1704 7.5.1.2. CodecPrivate: storage of global WebVTT blocks 1706 This element contains all global blocks before the first subtitle 1707 entry. This starts at the ""WEBVTT"" file identification marker but 1708 excludes the optional byte order mark. 1710 7.5.1.3. Storage of non-global WebVTT blocks 1712 Non-global WebVTT blocks (e.g. "NOTE") before a WebVTT Cue Text are 1713 stored in Matroska's BlockAddition element together with the Matroska 1714 Block containing the WebVTT Cue Text these blocks precede (see below 1715 for the actual format). 1717 7.5.1.4. Storage of Cues in Matroska blocks 1719 Each WebVTT Cue Text is stored directly in the Matroska Block. 1721 A muxer MUST change all WebVTT Cue Timestamps present within the Cue 1722 Text to be relative to the Matroska Block's timestamp. 1724 The Cue's start timestamp is used as the Matroska Block's timestamp. 1726 The difference between the Cue's end timestamp and its start 1727 timestamp is used as the Matroska Block's duration. 1729 7.5.1.5. BlockAdditions: storing non-global WebVTT blocks, Cue Settings 1730 Lists and Cue identifiers 1732 Each Matroska Block may be accompanied by one BlockAdditions element. 1733 Its format is as follows: 1735 1. The first line contains the WebVTT Cue Text's optional Cue 1736 Settings List followed by one line feed character (U+0x000a). 1737 The Cue Settings List may be empty in which case the line 1738 consists of the line feed character only. 1740 2. The second line contains the WebVTT Cue Text's optional Cue 1741 Identifier followed by one line feed character (U+0x000a). The 1742 line may be empty indicating that there was no Cue Identifier in 1743 the source file in which case the line consists of the line feed 1744 character only. 1746 3. The third and all following lines contain all WebVTT Comment 1747 Blocks that precede the current WebVTT Cue Block. These may be 1748 absent. 1750 If there is no Matroska BlockAddition element stored together with 1751 the Matroska Block then all three components (Cue Settings List, Cue 1752 Identifier, Cue Comments) MUST be assumed to be absent. 1754 7.5.2. Examples of transformation 1756 Here's an example how a WebVTT is transformed. 1758 7.5.2.1. Example WebVTT file 1760 Let's take the following example file: 1762 WEBVTT with text after the signature 1764 STYLE 1765 ::cue { 1766 background-image: linear-gradient(to bottom, dimgray, lightgray); 1767 color: papayawhip; 1768 } 1769 /* Style blocks cannot use blank lines nor "dash dash greater \ 1770 than" */ 1772 NOTE comment blocks can be used between style blocks. 1774 STYLE 1775 ::cue(b) { 1776 color: peachpuff; 1777 } 1779 REGION 1780 id:bill 1781 width:40% 1782 lines:3 1783 regionanchor:0%,100% 1784 viewportanchor:10%,90% 1785 scroll:up 1787 NOTE 1788 Notes always span a whole block and can cover multiple 1789 lines. Like this one. 1790 An empty line ends the block. 1792 hello 1793 00:00:00.000 --> 00:00:10.000 1794 Example entry 1: Hello world. 1796 NOTE style blocks cannot appear after the first cue. 1798 00:00:25.000 --> 00:00:35.000 1799 Example entry 2: Another entry. 1800 This one has multiple lines. 1802 00:01:03.000 --> 00:01:06.500 position:90% align:right size:35% 1803 Example entry 3: That stuff to the right of the timestamps are cue \ 1804 settings. 1806 00:03:10.000 --> 00:03:20.000 1807 Example entry 4: Entries can even include timestamps. 1808 For example:<00:03:15.000>This becomes visible five seconds 1809 after the first part. 1811 7.5.2.2. Example of CodecPrivate 1813 The resulting CodecPrivate element will look like this: 1815 WEBVTT with text after the signature 1817 STYLE 1818 ::cue { 1819 background-image: linear-gradient(to bottom, dimgray, lightgray); 1820 color: papayawhip; 1821 } 1822 /* Style blocks cannot use blank lines nor "dash dash greater \ 1823 than" */ 1825 NOTE comment blocks can be used between style blocks. 1827 STYLE 1828 ::cue(b) { 1829 color: peachpuff; 1830 } 1832 REGION 1833 id:bill 1834 width:40% 1835 lines:3 1836 regionanchor:0%,100% 1837 viewportanchor:10%,90% 1838 scroll:up 1840 NOTE 1841 Notes always span a whole block and can cover multiple 1842 lines. Like this one. 1843 An empty line ends the block. 1845 7.5.2.3. Storage of Cue 1 1847 Example Cue 1: timestamp 00:00:00.000, duration 00:00:10.000, Block's 1848 content: 1850 Example entry 1: Hello world. 1852 BlockAddition's content starts with one empty line as there's no Cue 1853 Settings List: 1855 hello 1857 7.5.2.4. Storage of Cue 2 1859 Example Cue 2: timestamp 00:00:25.000, duration 00:00:10.000, Block's 1860 content: 1862 Example entry 2: Another entry. 1863 This one has multiple lines. 1865 BlockAddition's content starts with two empty lines as there's 1866 neither a Cue Settings List nor a Cue Identifier: 1868 NOTE style blocks cannot appear after the first cue. 1870 7.5.2.5. Storage of Cue 3 1872 Example Cue 3: timestamp 00:01:03.000, duration 00:00:03.500, Block's 1873 content: 1875 Example entry 3: That stuff to the right of the timestamps are cue \ 1876 settings. 1878 BlockAddition's content ends with an empty line as there's no Cue 1879 Identifier and there were no WebVTT Comment blocks: 1881 position:90% align:right size:35% 1883 7.5.2.6. Storage of Cue 4 1885 Example Cue 4: timestamp 00:03:10.000, duration 00:00:10.000, Block's 1886 content: 1888 Example entry 4: Entries can even include timestamps. For 1889 example:00:00:05.000 (00:00:05.000)This becomes visible five seconds 1890 after the first part. 1892 This Block does not need a BlockAddition as the Cue did not contain 1893 an Identifier, nor a Settings List, and it wasn't preceded by Comment 1894 blocks. 1896 7.5.3. Storage of WebVTT in Matroska vs. WebM 1898 Note: the storage of WebVTT in Matroska is not the same as the design 1899 document for storage of WebVTT in WebM. There are several reasons 1900 for this including but not limited to: the WebM document is old (from 1901 February 2012) and was based on an earlier draft of WebVTT and 1902 ignores several parts that were added to WebVTT later; WebM does 1903 still not support subtitles at all (http://www.webmproject.org/docs/ 1904 container/); the proposal suggests splitting the information across 1905 multiple tracks making demuxer's and remuxer's life very difficult. 1907 7.6. HDMV presentation graphics subtitles 1909 The specifications for the HDMV presentation graphics subtitle format 1910 (short: HDMV PGS) can be found in the document "Blu-ray Disc Read- 1911 Only Format; Part 3 -- Audio Visual Basic Specifications" in section 1912 9.14 "HDMV graphics streams". 1914 7.6.1. Storage of HDMV presentation graphics subtitles 1916 The CodecID to use is "S_HDMV/PGS". A CodecPrivate element is not 1917 used. 1919 7.6.1.1. Storage of HDMV PGS Segments in Matroska Blocks 1921 Each HDMV PGS Segment (short: Segment) will be stored in a Matroska 1922 Block. A Segment is the data structure described in section 9.14.2.1 1923 "Segment coding structure and parameters" of the Blu-ray 1924 specifications. 1926 Each Segment contains a presentation timestamp. This timestamp will 1927 be used as the timestamp for the Matroska Block. 1929 A Segment is normally shown until a subsequent Segment is 1930 encountered. Therefore the Matroska Block MAY have no Duration. In 1931 that case a player MUST display a Segment within a Matroska Block 1932 until the next Segment is encountered. 1934 A muxer MAY use a Duration, e.g. by calculating the distance between 1935 two subsequent Segments. If a Matroska Block has a Duration, a 1936 player MUST display that Segment only for the duration of the Block's 1937 Duration. 1939 7.7. HDMV text subtitles 1941 The specifications for the HDMV text subtitle format (short: HDMV 1942 TextST) can be found in the document "Blu-ray Disc Read-Only Format; 1943 Part 3 -- Audio Visual Basic Specifications" in section 9.15 "HDMV 1944 text subtitle streams". 1946 7.7.1. Storage of HDMV text subtitles 1948 The CodecID to use is "S_HDMV/TEXTST". 1950 A CodecPrivate Element is required. It MUST contain the stream's 1951 Dialog Style Segment as described in section 9.15.4.2 "Dialog Style 1952 Segment" of the Blu-ray specifications. 1954 7.7.1.1. Storage of HDMV TextST Dialog Presentation Segments in 1955 Matroska Blocks 1957 Each HDMV Dialog Presentation Segment (short: Segment) will be stored 1958 in a Matroska Block. A Segment is the data structure described in 1959 section 9.15.4.3 "Dialog presentation segment" of the Blu-ray 1960 specifications. 1962 Each Segment contains a start and an end presentation timestamp 1963 (short: start PTS & end PTS). The start PTS will be used as the 1964 timestamp for the Matroska Block. The Matroska Block MUST have a 1965 Duration, and that Duration is the difference between the end PTS and 1966 the start PTS. 1968 A player MUST use the Matroska Block's timestamp and Duration instead 1969 of the Segment's start and end PTS for determining when and how long 1970 to show the Segment. 1972 7.7.1.2. Character set 1974 When TextST subtitles are stored inside Matroska, the only allowed 1975 character set is UTF-8. 1977 Each HDMV text subtitle stream in a Blu-ray can use one of a handful 1978 of character sets. This information is not stored in the MPEG2 1979 Transport Stream itself but in the accompanying Clip Information 1980 file. 1982 Therefore a muxer MUST parse the accompanying Clip Information file. 1983 If the information indicates a character set other than UTF-8, it 1984 MUST re-encode all text Dialog Presentation Segments from the 1985 indicated character set to UTF-8 prior to storing them in Matroska. 1987 7.8. Digital Video Broadcasting (DVB) subtitles 1989 The specifications for the Digital Video Broadcasting subtitle 1990 bitstream format (short: DVB subtitles) can be found in the document 1991 "ETSI EN 300 743 - Digital Video Broadcasting (DVB); Subtitling 1992 systems". The storage of DVB subtitles in MPEG transport streams is 1993 specified in the document "ETSI EN 300 468 - Digital Video 1994 Broadcasting (DVB); Specification for Service Information (SI) in DVB 1995 systems". 1997 7.8.1. Storage of DVB subtitles 1999 7.8.1.1. CodecID 2001 The CodecID to use is "S_DVBSUB". 2003 7.8.1.2. CodecPrivate 2005 The CodecPrivate element is five bytes long and has the following 2006 structure: 2008 * 2 bytes: composition page ID (bit string, left bit first) 2010 * 2 bytes: ancillary page ID (bit string, left bit first) 2012 * 1 byte: subtitling type (bit string, left bit first) 2014 The semantics of these bytes are the same as the ones described in 2015 section 6.2.41 "Subtitling descriptor" of ETSI EN 300 468. 2017 7.8.1.3. Storage of DVB subtitles in Matroska Blocks 2019 Each Matroska Block consists of one or more DVB Subtitle Segments as 2020 described in segment 7.2 "Syntax and semantics of the subtitling 2021 segment" of ETSI EN 300 743. 2023 Each Matroska Block SHOULD have a Duration indicating how long the 2024 DVB Subtitle Segments in that Block SHOULD be displayed. 2026 8. Block Additional Mapping 2028 Extra data or metadata can be added to each "Block" using 2029 "BlockAdditional" data. Each "BlockAdditional" contains a 2030 "BlockAddID" that identifies the kind of data it contains. When the 2031 "BlockAddID" is set to "1" the contents of the "BlockAdditional 2032 Element" are define by the Codec Mappings defines (see 2033 Section 6.1.5). When the "BlockAddID" is set a value greater than 2034 "1", then the contents of the "BlockAdditional Element" are defined 2035 by the "BlockAdditionalMapping Element" within the associated "Track 2036 Element" where the "BlockAddID Element" of "BlockAdditional Element" 2037 equals the "BlockAddIDValue" of the associated Track's 2038 "BlockAdditionalMapping Element". That "BlockAdditionalMapping 2039 Element" then identifies a particular Block Additional Mapping by the 2040 "BlockAddIDType". 2042 The following XML depicts a use of a Block Additional Mapping to 2043 associate a timecode value with a "Block": 2045 1 568001708 1 2 timecode 12 V_FFV1 3000 {binary video frame} 2 01:00:00:00 2047 Block Additional Mappings detail how additional data MAY be stored in 2048 the "BlockMore Element" with a "BlockAdditionMapping Element" within 2049 the "Track Element" which identifies the "BlockAdditional" content. 2050 Block Additional Mappings define the "BlockAddIDType" value reserved 2051 to identify that type of data as well as providing an optional label 2052 stored within the "BlockAddIDName Element". When the Block 2053 Additional Mapping is dependent on additional contextual information 2054 then the Mapping SHOULD describe how such additional contextual 2055 information is stored within the "BlockAddIDExtraData Element". 2057 The following Block Additional Mappings are defined. 2059 9. Normative References 2061 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2062 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2063 May 2017, . 2065 [RFC3339] Klyne, G. and C. Newman, "Date and Time on the Internet: 2066 Timestamps", RFC 3339, DOI 10.17487/RFC3339, July 2002, 2067 . 2069 [RFC6648] Saint-Andre, P., Crocker, D., and M. Nottingham, 2070 "Deprecating the "X-" Prefix and Similar Constructs in 2071 Application Protocols", BCP 178, RFC 6648, 2072 DOI 10.17487/RFC6648, June 2012, 2073 . 2075 [RFC6386] Bankoski, J., Koleszar, J., Quillio, L., Salonen, J., 2076 Wilkins, P., and Y. Xu, "VP8 Data Format and Decoding 2077 Guide", RFC 6386, DOI 10.17487/RFC6386, November 2011, 2078 . 2080 [IEEE.754.1985] 2081 Institute of Electrical and Electronics Engineers, 2082 "Standard for Binary Floating-Point Arithmetic", August 2083 1985. 2085 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2086 Requirement Levels", BCP 14, RFC 2119, 2087 DOI 10.17487/RFC2119, March 1997, 2088 . 2090 Authors' Addresses 2091 Steve Lhomme 2093 Email: slhomme@matroska.org 2095 Moritz Bunkus 2097 Email: moritz@bunkus.org 2099 Dave Rice 2101 Email: dave@dericed.com