Skip to content

Commit 1d11067

Browse files
Clarification about when CodecPrivate is mandatory
1 parent 0651bbb commit 1d11067

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed

codec_specs.md

+37-14
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ which **MUST** be stored within the `CodecPrivate Element`. When the Initializat
7171
within a track, then that updated Initialization data **MUST** be written into the `CodecState Element`
7272
of the first `Cluster` to require it. If the encoding does not require any form of Initialization,
7373
then `none` **MUST** be used to define the Initialization and the `CodecPrivate Element`
74-
**SHOULD NOT** be written and **MUST** be ignored. Data that is defined Initialization to be
75-
stored in the `CodecPrivate Element` is known as `Private Data`.
74+
**SHOULD NOT** be written and **MUST** be ignored. If the encoding does require any form of Initialization,
75+
then `CodecPrivate Element` **MUST** be written and **MUST** be provided to the decoder.
76+
The Initialization data to be stored in the `CodecPrivate Element` is referred to as `Private Data`.
7677

7778
### Codec BlockAdditions
7879

@@ -332,8 +333,8 @@ Codec Name: Theora
332333

333334
Initialization: The `Private Data` contains the first three Theora packets in order. The lengths of the packets precedes them. The actual layout is:
334335

335-
* Byte 1: number of distinct packets `#p` minus one inside the CodecPrivate block. This **MUST** be "2" for current (as of 2016-07-08) Theora headers.
336-
* Bytes 2..n: lengths of the first `#p` packets, coded in Xiph-style lacing. The length of the last packet is the length of the CodecPrivate block minus the lengths coded in these bytes minus one.
336+
* Byte 1: number of distinct packets `#p` minus one inside the `Private Data`. This **MUST** be "2" for current (as of 2016-07-08) Theora headers.
337+
* Bytes 2..n: lengths of the first `#p` packets, coded in Xiph-style lacing. The length of the last packet is the length of the `Private Data` minus the lengths coded in these bytes minus one.
337338
* Bytes n+1..: The Theora identification header, followed by the commend header followed by the codec setup header. Those are described in the [Theora specs](http://www.theora.org/doc/Theora.pdf).
338339

339340
### V_PRORES
@@ -389,7 +390,7 @@ Description: FFV1 is a lossless intra-frame video encoding format designed to ef
389390
Compared to uncompressed video, FFV1 offers storage compression, frame fixity, and self-description,
390391
which makes FFV1 useful as a preservation or intermediate video format. [Draft FFV1 Specification](https://datatracker.ietf.org/doc/draft-ietf-cellar-ffv1/)
391392

392-
Initialization: For FFV1 versions 0 or 1, `Private Data` **SHOULD NOT** be written. For FFV1 version 3 or greater, the `Private Data` **MUST** contain the FFV1 Configuration Record structure, as defined in https://tools.ietf.org/html/draft-ietf-cellar-ffv1-04#section-4.2, and no other data.
393+
Initialization: For FFV1 versions 0 or 1, none. For FFV1 version 3 or greater, the `Private Data` contains the FFV1 Configuration Record structure, as defined in https://tools.ietf.org/html/draft-ietf-cellar-ffv1-04#section-4.2, and no other data.
393394

394395
## Audio Codec Mappings
395396

@@ -471,9 +472,11 @@ Codec ID: A_AC3
471472

472473
Codec Name: (Dolby™) AC3
473474

474-
Description: BSID <= 8 !! The private data is void ??? Corresponding ACM wFormatTag : 0x2000 ; channel number have
475+
Description: For BSID <= 8. Corresponding ACM wFormatTag : 0x2000 ; channel number have
475476
to be read from the corresponding audio element
476477

478+
Initialization: none
479+
477480
### A_AC3/BSID9
478481

479482
Codec ID: A_AC3/BSID9
@@ -549,10 +552,10 @@ Codec ID: A_VORBIS
549552
Codec Name: Vorbis
550553

551554
Initialization: The `Private Data` contains the first three Vorbis packet in order. The lengths of the packets precedes them. The actual layout is:
552-
- Byte 1: number of distinct packets `#p` minus one inside the CodecPrivate block.
555+
- Byte 1: number of distinct packets `#p` minus one inside the `Private Data`.
553556
This **MUST** be "2" for current (as of 2016-07-08) Vorbis headers.
554557
- Bytes 2..n: lengths of the first `#p` packets, coded in Xiph-style lacing.
555-
The length of the last packet is the length of the CodecPrivate block minus the lengths coded in these bytes minus one.
558+
The length of the last packet is the length of the `Private Data` minus the lengths coded in these bytes minus one.
556559
- Bytes n+1..: The [Vorbis identification header](https://xiph.org/vorbis/doc/Vorbis_I_spec.html),
557560
followed by the [Vorbis comment header](https://xiph.org/vorbis/doc/v-comment.html)
558561
followed by the [codec setup header](https://xiph.org/vorbis/doc/Vorbis_I_spec.html).
@@ -815,24 +818,30 @@ Codec Name: UTF-8 Plain Text
815818

816819
Description: Basic text subtitles. For more information, see (#subtitles) on Subtitles.
817820

821+
Initialization: none
822+
818823
### S_TEXT/SSA
819824

820825
Codec ID: S_TEXT/SSA
821826

822827
Codec Name: Subtitles Format
823828

824-
Description: The [Script Info] and [V4 Styles] sections are stored in the codecprivate. Each event is stored in its own Block.
829+
Description: Each event is stored in its own Block.
825830
For more information, see (#ssa-ass-subtitles) on SSA/ASS.
826831

832+
Initialization: The `Private Data` contains the [Script Info] and [V4 Styles] sections.
833+
827834
### S_TEXT/ASS
828835

829836
Codec ID: S_TEXT/ASS
830837

831838
Codec Name: Advanced Subtitles Format
832839

833-
Description: The [Script Info] and [V4 Styles] sections are stored in the codecprivate. Each event is stored in its own Block.
840+
Description: Each event is stored in its own Block.
834841
For more information, see (#ssa-ass-subtitles) on SSA/ASS.
835842

843+
Initialization: The `Private Data` contains the [Script Info] and [V4+ Styles] sections.
844+
836845
### S_TEXT/WEBVTT
837846

838847
Codec ID: S_TEXT/WEBVTT
@@ -841,6 +850,8 @@ Codec Name: Web Video Text Tracks Format (WebVTT)
841850

842851
Description: Advanced text subtitles. For more information, see (#webvtt) on WebVTT.
843852

853+
Initialization: none
854+
844855
### S_IMAGE/BMP
845856

846857
Codec ID: S_IMAGE/BMP
@@ -852,6 +863,8 @@ The timestamp in the block header of Matroska indicates the start display time,
852863
the duration is set with the Duration element. The full data for the subtitle bitmap
853864
is stored in the Block's data section.
854865

866+
Initialization: none
867+
855868
### S_DVBSUB
856869

857870
Codec ID: S_DVBSUB
@@ -861,6 +874,8 @@ Codec Name: Digital Video Broadcasting (DVB) subtitles
861874
Description: This is the graphical subtitle format used in the Digital Video Broadcasting standard.
862875
For more information, see (#digital-video-broadcasting-dvb-subtitles) on Digital Video Broadcasting (DVB).
863876

877+
Initialization: none
878+
864879
### S_VOBSUB
865880

866881
Codec ID: S_VOBSUB
@@ -869,16 +884,16 @@ Codec Name: VobSub subtitles
869884

870885
Description: The same subtitle format used on DVDs. Supported is only format version 7 and newer.
871886
VobSubs consist of two files, the .idx containing information, and the .sub, containing the actual data.
872-
The .idx file is stripped of all empty lines, of all comments and of lines beginning with `alt:` or `langidx:`.
873-
The line beginning with `id:` **SHOULD** be transformed into the appropriate Matroska track language element
874-
and is discarded. All remaining lines but the ones containing timestamps and file positions
875-
are put into the `CodecPrivate` element.
876887

877888
For each line containing the timestamp and file position data is read from the appropriate
878889
position in the .sub file. This data consists of a MPEG program stream which in turn
879890
contains SPU packets. The MPEG program stream data is discarded, and each SPU packet
880891
is put into one Matroska frame.
881892

893+
Initialization: The .idx file is stripped of all empty lines, of all comments and of lines beginning with `alt:` or `langidx:`.
894+
The line beginning with `id:` **SHOULD** be transformed into the appropriate Matroska track language element
895+
and is discarded. The `Private Data` contains all remaining lines but the ones containing timestamps and file positions.
896+
882897
### S_HDMV/PGS
883898

884899
Codec ID: S_HDMV/PGS
@@ -888,6 +903,8 @@ Codec Name: HDMV presentation graphics subtitles (PGS)
888903
Description: This is the graphical subtitle format used on Blu-rays. For more information,
889904
see (#hdmv-text-subtitles) on HDMV text presentation.
890905

906+
Initialization: none
907+
891908
### S_HDMV/TEXTST
892909

893910
Codec ID: S_HDMV/TEXTST
@@ -897,6 +914,8 @@ Codec Name: HDMV text subtitles
897914
Description: This is the textual subtitle format used on Blu-rays. For more information,
898915
see (#hdmv-presentation-graphics-subtitles) on HDMV graphics presentation.
899916

917+
Initialization: none
918+
900919
### S_KATE
901920

902921
Codec ID: S_KATE
@@ -907,6 +926,8 @@ Description: A subtitle format developed for ogg. The mapping for Matroska is de
907926
on the [Xiph wiki](http://wiki.xiph.org/index.php/OggKate#Matroska_mapping).
908927
As for Theora and Vorbis, Kate headers are stored in the private data as xiph-laced packets.
909928

929+
Initialization: none
930+
910931
## Button Codec Mappings
911932

912933
### B_VOBBTN
@@ -919,6 +940,8 @@ Description: Based on [MPEG/VOB PCI packets](http://dvd.sourceforge.net/dvdinfo/
919940
The file contains a header consisting of the string "butonDVD" followed by the width and height
920941
in pixels (16 bits integer each) and 4 reserved bytes. The rest is full [PCI packets](http://dvd.sourceforge.net/dvdinfo/pci_pkt.html).
921942

943+
Initialization: none
944+
922945
## Block Addition Mappings
923946

924947
Registered `BlockAddIDType` are:

ebml_matroska.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ If this Element is used, then any Language Elements used in the same TrackEntry
398398
see [@!I-D.ietf-cellar-codec] for more info.</documentation>
399399
</element>
400400
<element name="CodecPrivate" path="\Segment\Tracks\TrackEntry\CodecPrivate" id="0x63A2" type="binary" maxOccurs="1">
401-
<documentation lang="en" purpose="definition">Private data only known to the codec.</documentation>
401+
<documentation lang="en" purpose="definition">Private data only known to the codec. This element **MUST NOT** be present if the codec mapping specification defines no initialization or an initialization `none`, else **MUST** be present.</documentation>
402402
</element>
403403
<element name="CodecName" path="\Segment\Tracks\TrackEntry\CodecName" id="0x258688" type="utf-8" maxOccurs="1">
404404
<documentation lang="en" purpose="definition">A human-readable string specifying the codec.</documentation>

0 commit comments

Comments
 (0)