How AVIF Decoders Associate Alpha Images

AVIF files handle transparency by storing alpha data as a distinct, auxiliary monochrome image rather than embedding it directly inside the primary color bitstream. An AVIF decoder associates this auxiliary alpha image with its parent color image by parsing structural metadata defined by the ISO Base Media File Format (ISOBMFF) and the Multi-Image Application Format (MIAF). Specifically, the decoder inspects the file's item references to find an auxl (auxiliary) relationship and verifies the auxiliary image's role using an auxiliary type property box.

The Architecture of Alpha in AVIF

Unlike older formats that interleave alpha channels directly with color channels (such as RGBA in standard PNGs), the underlying AV1 video codec natively encodes color as YUV or monochrome planes. To support transparency efficiently without altering the core AV1 profile requirements, AVIF separates the color data and transparency data into two independent image items:

  1. The Primary Image Item: An AV1 bitstream containing the color data (typically YUV 4:2:0 or 4:4:4).
  2. The Auxiliary Image Item: A separate, monochrome AV1 bitstream (Y-only) representing the grayscale opacity mask.

The Association Mechanism

The association between these two separate streams is established purely through metadata within the file container. An AVIF decoder executes the following steps to link them:

1. Identifying the Primary Item

The decoder reads the Primary Item Box (pitm) located inside the Meta Box (meta). This identifies the item_ID of the master color image that forms the base visual content.

2. Resolving the Item Reference Box (iref)

The decoder inspects the Item Reference Box (iref). This box defines directional links between different items in the container. To find an alpha plane, the decoder searches for a reference box with the reference type set to auxl (auxiliary):

This link explicitly signals to the decoder that the referenced item exists only to modify or complement the parent image.

3. Verifying the Auxiliary Type (auxC)

A file may contain multiple auxiliary images (such as depth maps or gain maps). To confirm that a specific auxiliary item represents transparency, the decoder checks the Item Properties Box (iprp).

Associated with the auxiliary item is an Auxiliary Type Property (auxC). For transparency, this property contains the standardized Uniform Resource Name (URN): urn:mpeg:hevc:2015:auxid:1

When the decoder identifies this identifier, it flags the auxiliary stream as an alpha channel.

Decoding and Reconstruction

Once the association is confirmed: