1. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes.
Examples in this specification are introduced with the words "for example" or are set apart from the normative text with class="example", like this:
Informative notes begin with the word "Note" and are set apart from the normative text with class="note", like this:
NOTE: This is an example of an informative note.
2. Bitstream features overview
An AV2 bitstream is composed of a sequence of OBUs (Open Bitstream Units), grouped into Temporal Units. A Temporal Unit consists of a Temporal Delimiter OBU and all following OBUs up to, but not including, the next Temporal Delimiter OBU. Each Temporal Unit is associated with a single presentation time.
Every OBU begins with a 1- or 2-byte header that carries the obu_type and the temporal layer identifier obu_tlayer_id. When the OBU header extension is present (i.e. when obu_header_extension_flag is equal to 1 in that header), two additional layer identifiers are carried: the embedded layer identifier obu_mlayer_id and the extended layer identifier obu_xlayer_id. Depending on its type, an OBU can carry configuration information (e.g., a Sequence Header OBU or Layer Configuration Record OBU), metadata, or coded video data.
A Temporal Unit MAY contain multiple coded pictures but only one is output. AV2 defines a number of coded-frame OBU types, including Closed Loop Key OBUs, Open Loop Key OBUs, regular and leading tile-group OBUs, Switch OBUs, OBU_RAS_FRAME, Bridge Frame OBUs, and TIP (Temporally Interpolated Prediction) frames.
Frames that can be decoded without reference to other frames are Key Frames (carried in a Closed Loop Key OBU or an Open Loop Key OBU) and Intra frames. All other coded frames - including Inter Frames, Switch Frames, RAS frames, Bridge frames, TIP frames, and frames with show_existing_frame equal to 1 - have coding dependencies on other frames in the same or previous Temporal Units.
A Closed Random Access is the random access process that applies to an extended layer whose first coded frame is a Key Frame carried in a Closed Loop Key OBU. It starts a new coded video sequence for the extended layer; the layer’s reference frame buffers are invalidated and every subsequent frame of that layer can be decoded. This is the primary random-access mechanism.
An Open Random Access is the random access process that applies to an extended layer whose first coded frame is a Key Frame carried in an Open Loop Key OBU. During sequential decoding, an Open Random Access point does not start a new coded video sequence; however, when a decoder initiates decoding at that point, the decoding process is treated as if it were the start of a new coded video sequence for the extended layer. Leading frames that follow an Open Random Access point MAY reference frames that precede it, and are discarded when decoding begins at the Open Random Access point.
In addition to Key Frames, AV2 provides two further mechanisms that support random access or stream switching: a RAS frame (OBU_RAS_FRAME) is an inter-predicted frame that uses long-term reference frames and enables random access or switching without inserting a full key frame; a Switch Frame (OBU_SWITCH) is an inter-predicted frame that enables switching between representations at a given point, typically in adaptive streaming scenarios.
AV2 supports three scalability dimensions: temporal layers (identified by obu_tlayer_id), embedded layers (identified by obu_mlayer_id), and extended layers (identified by obu_xlayer_id). The reserved obu_xlayer_id value GLOBAL_XLAYER_ID (equal to 31, as defined in [AV2]) denotes global scope and is used by OBUs that do not belong to any specific extended layer (such as the Temporal Delimiter OBU). A bitstream that uses a single distinct non-global value of obu_xlayer_id is a Singlestream bitstream; a bitstream that uses two or more distinct non-global values is a Multistream bitstream.
AV2 defines two distinct Metadata OBU types for carrying metadata: OBU_METADATA_SHORT, using the metadata short OBU syntax, and OBU_METADATA_GROUP, using the metadata group OBU syntax. A separate OBU type carries film grain synthesis parameters; its presence is indicated by the film_grain_params_present flag in the Sequence Header OBU.
The Sequence Header OBU also carries the bitstream’s profile, level, and - when applicable - tier, as defined in Annex A of [AV2].
The Sequence Header OBU carries a monotonic_output_order_flag that defines the output mode of the associated coded video sequence.
When monotonic_output_order_flag is equal to 1, the output order of coded output frame equals their decoding order within the coded video sequence. Within a sample, the composition time (CTS) of the associated output frame is equal to the sample’s decoding time (DTS); the sample MAY additionally contain hidden frames.
When monotonic_output_order_flag is equal to 0, the output order of coded output frames MAY differ from their decoding order. The composition time of each sample is then derived from a ctts box that signals the offset between the sample’s decoding time (DTS) and the composition time of its associated output frame. As in the monotonic case, a sample MAY additionally contain hidden frames.
NOTE: Non-monotonic output mode is new in AV2; AV1 supports only the monotonic mode.
3. Basic Encapsulation Scheme
This section describes the basic data structures used to signal encapsulation of AV2 bitstreams in [ISOBMFF] containers.
There are two locations where [AV2]-specific data can be found in a file conformant to this specification:
-
Some High-Level Syntax fields are carried in the AV2CodecConfigurationBox as described in § 3.2 AV2 Sample Entry and Configuration.
An AV2 sample is the union of a sample, the OBUs carried in the AV2CodecConfigurationBox of the corresponding AV2SampleEntry, and an implicit Temporal Delimiter OBU.
NOTE: This specification refers to samples as defined in [ISOBMFF], which are not to be mistaken with samples or sample values as defined in the [AV2] specification.
3.1. General Requirements & Brands
A file conformant to this specification satisfies the following:
- It SHALL conform to the normative requirements of [ISOBMFF]
- It SHALL have the av02 brand among the compatible brands array of the FileTypeBox
- It SHALL contain at least one track using an AV2SampleEntry, possibly transformed by encryption as specified in § 5 Common Encryption
- It SHOULD indicate a structural ISOBMFF brand among the compatible brands array of the FileTypeBox, such as iso6
- It SHALL contain at least one AV2 sample
- Each AV2 sample it contains SHALL form exactly one [AV2] Temporal Unit
3.2. AV2 Sample Entry and Configuration
3.2.1. AV2 Sample Entry
The AV2SampleEntry extends VisualSampleEntry and signals a track carrying AV2 samples.
An AV2SampleEntry SHALL contain exactly one AV2CodecConfigurationBox. An AV2SampleEntry SHALL contain exactly one colr box with the nclx colour_type. Each value amongclass AV2SampleEntry extends VisualSampleEntry ( 'av02 ') { AV2CodecConfigurationBox config ; }
colour_primaries, transfer_characteristics, and matrix_coefficients carried in that colr box:
- SHOULD equal the corresponding effective value of the AV2 bitstream carried by the track if the latter is anything but 2 (
Unspecified); - SHALL take precedence over the corresponding effective value of the AV2 bitstream carried by the track.
full_range_flag carried in that colr box SHOULD equal the corresponding effective value of the AV2 bitstream carried by the track and SHALL take precedence over the corresponding effective value of the AV2 bitstream carried by the track.
An AV2SampleEntry SHALL contain exactly one pixi box. That box SHALL have the least significant bit of px_flags enabled. The constraints described in § 3.3.4 Layers apply to that AV2SampleEntry.
NOTE: An AV2SampleEntry may contain additional sub-boxes permitted by [ISOBMFF] for a VisualSampleEntry, such as colr with a colour_type value other than nclx, pasp, clli, mdcv or btrt. They may be located before and/or after the AV2CodecConfigurationBox.
3.2.2. AV2 Codec Configuration Box
The AV2CodecConfigurationBox carries decoder initialisation data for the AV2 samples of a track.
aligned ( 8 ) class AV2CodecConfigurationBox extends Box ( 'av2C ') { unsigned int ( 5 ) max_profile_idc ; unsigned int ( 5 ) max_level_idx ; unsigned int ( 1 ) max_tier ; unsigned int ( 2 ) reserved1 = 0 ; unsigned int ( 2 ) max_num_streams_minus_1 ; unsigned int ( 1 ) reserved2 = 0 ; }
max_profile_idc specifies the maximum profile for the coded video sequence. There SHALL NOT be any Sequence Header OBU in the corresponding AV2 sample whose seq_profile_idc value is greater than max_profile_idc. There SHOULD be at least one Sequence Header OBU in the corresponding AV2 sample whose seq_profile_idc has the same value as max_profile_idc.
max_level_idx specifies the maximum level that the coded video sequence conforms to. There SHALL NOT be any Sequence Header OBU in the corresponding AV2 sample whose seq_level_idx value is greater than max_level_idx. There SHOULD be at least one Sequence Header OBU in the corresponding AV2 sample whose seq_level_idx has the same value as max_level_idx.
max_tier specifies the maximum tier that the coded video sequence conforms to. There SHALL NOT be any Sequence Header OBU in the corresponding AV2 sample whose seq_tier value is greater than max_tier. There SHOULD be at least one Sequence Header OBU in the corresponding AV2 sample whose seq_tier has the same value as max_tier.
reserved1 SHALL be set to 0. Readers SHALL ignore its value.
max_num_streams_minus_1 specifies the maximum number of independent streams in the bitstream. There SHALL NOT be any Multi Stream Decoder Operation OBU in the corresponding AV2 sample whose num_streams_minus_2 value is greater than or equal to max_num_streams_minus_1. If max_num_streams_minus_1 is not zero, there SHOULD be at least one Multi Stream Decoder Operation OBU in the corresponding AV2 sample.
NOTE: The above means there shall not be any Multi Stream Decoder Operation OBU in the corresponding AV2 sample if max_num_streams_minus_1 is set to 0.
NOTE: It is a requirement of bitstream conformance that num_streams_minus_2 is not greater than 2 in [AV2], so max_num_streams_minus_1 fits in two bits. reserved1 can be repurposed once num_streams_minus_2 uses its three allocated bits in a future version of [AV2].
reserved2 SHALL be set to 0. Readers SHALL ignore its value.
3.3. AV2 Sample Format
3.3.1. General
The AV2 sample boundary delimits the temporal unit.
Each OBU within a sample SHALL be framed using the Length delimited bitstream format specified in Annex B of [AV2]: each OBU is preceded by aleb128() num_bytes_in_obu field giving the byte length of the OBU that follows. Figure 3.1 illustrates this mapping.
3.3.2. OBUs in samples
There SHALL NOT be any Temporal Delimiter OBU within a sample. The OBUs within a sample, prepended with a Temporal Delimiter OBU, SHALL form a conformant AV2 bitstream as specified in [AV2]. There SHOULD NOT be any Metadata OBU within a sample if a container-level carriage solution exists for that metadata.Editor’s note: the Content Interpretation OBU (OBU_CONTENT_INTERPRETATION) carries picture-level interpretation metadata (for example, colour description) that overlaps ISOBMFF container-level signalling such as the ColourInformationBox. Whether to carry it in the track or replace it entirely with container-level signalling is to be resolved in this version.
3.3.3. Sync sample
An AV2 sample is a sync AV2 sample if, for every coded extended layer unit present in the AV2 sample, the first coded frame OBU of that coded extended layer unit has obu_type equal to OBU_CLOSED_LOOP_KEY. Such an AV2 sample is a Closed Random Access point for the carried bitstream and corresponds to a SAP of type 1 or 2 as defined in Annex I of [ISOBMFF].
NOTE: In ISOBMFF terms, sync samples are signalled using the SyncSampleBox (stss) in unfragmented tracks, or by setting sample_is_non_sync_sample equal to 0 in fragmented tracks. When every sample in a track is a sync sample, the SyncSampleBox is omitted in unfragmented tracks (per [ISOBMFF]), and in fragmented tracks this is expressed through the default sample flags of the MovieExtendsBox (trex) or TrackFragmentHeaderBox (tfhd) with no per-sample override.
3.3.4. Layers
The following applies to each coded extended layer unit in an AV2 sample associated with a pixi box:
-
The channels in the AV2 sample are considered to be ordered as if the embedded layers were concatenated in increasing
mlayer_idorder. - If the pixi box describes the Nth channel to be a color channel, the Nth channel in the AV2 sample SHALL be present and a color channel: if signalled, its associated
lcr_layer_typeSHALL be set to 0 (TEXTURE_LAYER). - If the pixi box describes the Nth channel to be an alpha channel, the Nth channel in the AV2 sample SHALL be present and an alpha channel: if signalled, its associated
lcr_layer_typeSHALL be set to 1 (AUX_LAYER) andlcr_auxiliary_typeto 0 (ALPHA_AUX). - If the pixi box describes the Nth channel to be a depth channel, the Nth channel in the AV2 sample SHALL be present and a depth channel: if signalled, its associated
lcr_layer_typeSHALL be set to 1 (AUX_LAYER) andlcr_auxiliary_typeto 1 (DEPTH_AUX).
PixelInformationBox with px_flags=1 and channel_idc set to 2, 3, 4, 1, 0, 0, 0, 5, 6 matches the following embedded layers: TEXTURE_LAYER/CHROMA_FORMAT_444, AUX_LAYER/SEGMENTATION_AUX/CHROMA_FORMAT_400, AUX_LAYER/GAIN_MAP_AUX/CHROMA_FORMAT_420, AUX_LAYER/ALPHA_AUX/CHROMA_FORMAT_400, AUX_LAYER/DEPTH_AUX/CHROMA_FORMAT_400.PixelInformationBox with px_flags=1 and channel_idc set to 7, 2, 3, 4 matches the following embedded layers: TEXTURE_LAYER/CHROMA_FORMAT_400, TEXTURE_LAYER/CHROMA_FORMAT_444.4. CMAF AV2 track format
TBD
5. Common Encryption
TBD
6. Codecs Parameter String
TBD