Each NAL unit follows its start code and begins with a two-byte header. Types 0 to 31 are VCL units, which carry coded slice data; types 32 to 63 are non-VCL units such as parameter sets and SEI.
NAL unit header
| Bits | Size | Name | Description |
|---|---|---|---|
| 15 | 1 | forbidden_zero_bit | always 0 |
| 14–9 | 6 | nal_unit_type | see NAL unit types |
| 8–3 | 6 | nuh_layer_id | the layer: 0 for ordinary single-layer video; 1 to 62 for the extra layers of multiview, scalable and 3D streams; 63 reserved. A decoder of a single-layer profile discards units whose layer is not 0 |
| 2–0 | 3 | nuh_temporal_id_plus1 | temporal sub-layer plus 1; never 0. TemporalId = this − 1, 0 to 6 |
So nal_unit_type = (first byte >> 1) & 63, and for a layer 0,
temporal ID 0 unit the second byte is 01. The header is never subject to
emulation prevention.
TemporalId must be 0 for IRAP slices (types 16 to 23), VPS, SPS, end of
sequence and end of bitstream units. It must not be 0 for TSA pictures, or for STSA
pictures in layer 0. An access unit delimiter and filler data take the
TemporalId of their access unit.
NAL unit types
| Type | Name | Contents | Class |
|---|---|---|---|
| 0 | TRAIL_N | slice segment of a trailing picture that is not TSA or STSA; sub-layer non-reference | VCL |
| 1 | TRAIL_R | the same, sub-layer reference | VCL |
| 2 | TSA_N | slice segment of a temporal sub-layer access picture; non-reference | VCL |
| 3 | TSA_R | the same, reference | VCL |
| 4 | STSA_N | slice segment of a step-wise temporal sub-layer access picture; non-reference | VCL |
| 5 | STSA_R | the same, reference | VCL |
| 6 | RADL_N | slice segment of a random access decodable leading picture; non-reference | VCL |
| 7 | RADL_R | the same, reference | VCL |
| 8 | RASL_N | slice segment of a random access skipped leading picture; non-reference | VCL |
| 9 | RASL_R | the same, reference | VCL |
| 10, 12, 14 | RSV_VCL_N10, …N12, …N14 | reserved, non-IRAP sub-layer non-reference | VCL |
| 11, 13, 15 | RSV_VCL_R11, …R13, …R15 | reserved, non-IRAP sub-layer reference | VCL |
| 16 | BLA_W_LP | slice segment of a broken link access picture, which may have RASL and RADL leading pictures | VCL |
| 17 | BLA_W_RADL | BLA picture that may have RADL but no RASL pictures | VCL |
| 18 | BLA_N_LP | BLA picture with no leading pictures | VCL |
| 19 | IDR_W_RADL | slice segment of an instantaneous decoding refresh picture, which may have RADL pictures | VCL |
| 20 | IDR_N_LP | IDR picture with no leading pictures | VCL |
| 21 | CRA_NUT | slice segment of a clean random access picture, which may have RASL and RADL pictures | VCL |
| 22, 23 | RSV_IRAP_VCL22, …23 | reserved IRAP types | VCL |
| 24–31 | RSV_VCL24 … RSV_VCL31 | reserved non-IRAP types | VCL |
| 32 | VPS_NUT | video parameter set | non-VCL |
| 33 | SPS_NUT | sequence parameter set | non-VCL |
| 34 | PPS_NUT | picture parameter set | non-VCL |
| 35 | AUD_NUT | access unit delimiter | non-VCL |
| 36 | EOS_NUT | end of sequence; no payload. The next picture is an IRAP picture that starts a new coded video sequence | non-VCL |
| 37 | EOB_NUT | end of bitstream; no payload, and nothing follows in this bitstream | non-VCL |
| 38 | FD_NUT | filler data: FF bytes, then the trailing bits | non-VCL |
| 39 | PREFIX_SEI_NUT | SEI messages placed before the slices they apply to | non-VCL |
| 40 | SUFFIX_SEI_NUT | SEI messages placed after the slices | non-VCL |
| 41–47 | RSV_NVCL41 … RSV_NVCL47 | reserved | non-VCL |
| 48–63 | UNSPEC48 … UNSPEC63 | unspecified, free for applications. RTP uses 48 for aggregation packets, 49 for fragmentation units and 50 for PACI packets (RFC 7798); these do not appear in a plain Annex B file | non-VCL |
Decoders ignore units with reserved types. Types 16 to 23 form the IRAP (intra random
access point) range: decoding can start at any IRAP picture. All slice segments of one
access unit have the same nal_unit_type.
Picture types
| Picture | Meaning |
|---|---|
| IDR | resets decoding; no picture after it refers to any picture before it. An IDR picture never has RASL pictures |
| CRA | an intra picture where decoding can start; leading pictures that refer to pictures before it (RASL) are dropped when decoding starts here |
| BLA | a CRA-like picture after a splice; its RASL pictures (if any) are always dropped |
| Leading (RADL, RASL) | follow an IRAP picture in decoding order but come before it in output order. RADL pictures decode correctly after random access; RASL pictures may not |
| Trailing | follow the IRAP picture in both decoding and output order |
| TSA, STSA | points where a decoder can switch up to a higher temporal sub-layer |
The _N types (0, 2, 4, 6, 8 and the reserved 10, 12, 14) mark sub-layer
non-reference pictures: no picture of the same temporal sub-layer uses them for
prediction, so they can be dropped.
Access unit delimiter
A type 35 unit marks the start of an access unit. Its payload is one field and the trailing bits:
| Name | Coding | Description |
|---|---|---|
pic_type | u(3) | which slice types the picture contains |
pic_type | Slice types that may be present |
|---|---|
| 0 | I |
| 1 | P, I |
| 2 | B, P, I |
| 3–7 | reserved; decoders ignore them |
So a whole AUD for an intra picture in layer 0 is 46 01 10: header, then
000 and the stop bit.
Order of NAL units in an access unit
An access unit holds one coded picture of layer 0 plus any NAL units of other layers and non-VCL units. A new access unit starts at the first of these that comes after the last slice of the previous picture: an AUD, VPS, SPS, PPS, prefix SEI, a unit of type 41 to 44 or 48 to 55, or else the first slice of the new picture.
- An AUD, when present, comes first; there is at most one per access unit in layer 0.
- VPS, SPS, PPS, prefix SEI and types 41 to 44 and 48 to 55 do not come after the last slice of the picture.
- Filler data, suffix SEI and types 45 to 47 and 56 to 63 do not come before the first slice.
- End of sequence is the last unit of layer 0 except for an end of bitstream, which is the last unit of all.
- The first slice segment of a picture has
first_slice_segment_in_pic_flagset; the others follow in tile and then raster order of their addresses.