Block Additional Mapping

Extra data or metadata can be added to each Block using BlockAdditional data. Each BlockAdditional contains a BlockAddID that identifies the kind of data it contains. When the BlockAddID is set to 1 the contents of the BlockAdditional Element are define by the Codec Mappings defines (see (#codec-blockadditions)). When the BlockAddID is set a value greater than 1, then the contents of the BlockAdditional Element are defined by the BlockAdditionalMapping Element within the associated Track Element where the BlockAddID Element of BlockAdditional Element equals the BlockAddIDValue of the associated Track’s BlockAdditionalMapping Element. That BlockAdditionalMapping Element then identifies a particular Block Additional Mapping by the BlockAddIDType.

The following XML depicts a use of a Block Additional Mapping to associate a timecode value with a Block:

<Segment>
  <!--Mandatory elements ommitted for readability-->
  <Tracks>
    <TrackEntry>
      <TrackNumber>1</TrackNumber>
      <TrackUID>568001708</TrackUID>
      <TrackType>1</TrackType>
      <BlockAdditionalMapping>
        <BlockAddIDValue>2</BlockAddIDValue><!--arbitrary value
          used in BlockAddID-->
        <BlockAddIDName>timecode</BlockAddIDName>
        <BlockAddIDType>12</BlockAddIDType>
      </BlockAdditionalMapping>
      <CodecID>V_FFV1</CodecID>
      <Video>
        <PixelWidth>1920</PixelWidth>
        <PixelHeight>1080</PixelHeight>
      </Video>
    </TrackEntry>
  </Tracks>
  <Cluster>
    <Timestamp>3000</Timestamp>
    <BlockGroup>
      <Block>{binary video frame}</Block>
      <BlockAdditions>
        <BlockMore>
          <BlockAddID>2</BlockAddID><!--arbitrary value from
            BlockAdditionalMapping-->
          <BlockAdditional>01:00:00:00</BlockAdditional>
        </BlockMore>
      </BlockAdditions>
    </BlockGroup>
  </Cluster>
</Segment>

Block Additional Mappings detail how additional data MAY be stored in the BlockMore Element with a BlockAdditionMapping Element within the Track Element which identifies the BlockAdditional content. Block Additional Mappings define the BlockAddIDType value reserved to identify that type of data as well as providing an optional label stored within the BlockAddIDName Element. When the Block Additional Mapping is dependent on additional contextual information then the Mapping SHOULD describe how such additional contextual information is stored within the BlockAddIDExtraData Element.

The following Block Additional Mappings are defined.

Summary of Assigned BlockAddIDType Values

For convenience, the following table shows the assigned BlockAddIDType values along with the BlockAddIDName and Citation.

BlockAddIDType BlockAddIDName Citation
121 SMPTE ST 12-1 timecode (#smpte-st-12-1-timecode)

SMPTE ST 12-1 Timecode

Timecode Description

SMPTE ST 12-1 timecode values can be stored in the BlockMore Element to associate the content of a Matroska Block with a particular timecode value. If the Block uses Lacing, the timecode value is associated with the first frame of the Lace.

The Block Additional Mapping contains a full binary representation of a 64 bit SMPTE timecode value stored in big endian format and expressed exactly as defined in Section 8 and 9 of SMPTE 12M [@!SMPTE-ST12]. For convenience, here are the bit assignments for a SMPTE ST 12-1 binary representation as described in Section 6.2 of [@?RFC5484]:

Bit Positions Label
0–3 Units of frames
4–7 First binary group
8–9 Tens of frames
10 Drop frame flag
11 Color frame flag
12–15 Second binary group
16–19 Units of seconds
20–23 Third binary group
24–26 Tens of seconds
27 Polarity correction
28–31 Fourth binary group
32–35 Units of minutes
36–39 Fifth binary group
40–42 Tens of minutes
43 Binary group flag BGF0
44–47 Sixth binary group
48–51 Units of hours
52–55 Seventh binary group
56–57 Tens of hours
58 Binary group flag BGF1
59 Binary group flag BGF2
60–63 Eighth binary group

For example, a timecode value of 07:32:54;18 can be expressed as a 64 bit SMPTE 12M value as:

10000000 01100000 01100000 01010000
00100000 00110000 01110000 00000000

BlockAddIDType

The BlockAddIDType value reserved for timecode is 121.

BlockAddIDName

The BlockAddIDName value reserved for timecode is “SMPTE ST 12-1 timecode”.

BlockAddIDExtraData

BlockAddIDExtraData is unused within this block additional mapping.