AVIF Parsing: Handling Unrecognized ISOBMFF Boxes
When an AVIF parser encounters an unrecognized ISOBMFF (ISO Base Media File Format) box, standard-compliant behavior dictates that the parser safely skips the box and continues reading the rest of the file. Because AVIF relies on the hierarchical, length-delimited structure of ISOBMFF, unknown boxes do not automatically halt processing or invalidate the image. Instead, this design guarantees forward and backward compatibility across different software versions and feature specifications, allowing readers to extract and render the image as long as core structural elements remain intact.
The Box Header and Skipping Mechanism
Every ISOBMFF box starts with a standard header that contains two primary fields:
- Size (32-bit or 64-bit integer): Specifies the total byte length of the box, including the header and any nested payload.
- Type (FourCC): A four-character code (such as
ftyp,meta, ormdat) identifying the purpose of the box.
Because the box length is established before the type is processed, a
parser does not need to understand the contents of a box to navigate
around it. If the FourCC represents an unknown or proprietary box type,
the parser reads the size field, advances its file offset
by that number of bytes from the start of the header, and resumes
evaluation at the next sibling box.
Impact on Image Decoding
The practical outcome of skipping an unknown box depends on whether the box contains non-essential metadata or vital decoding parameters:
- Non-Essential Metadata: If the unknown box
represents custom user data (such as extended EXIF variants,
vendor-specific tags, or newer optional color profiles), skipping it has
no negative effect on decoding. The primary compressed image item
located in the
mdatbox will still render properly. - Essential Items and References: If the unknown box
is an unknown type within a critical container—such as an unsupported
item property in the
iprp(Item Properties) container—the parser's behavior depends on the property's necessity. In MIAF (Multi-Image Application Format) and AVIF specifications, essential properties must be recognized. If a parser encounters an unknown box marked as essential to the primary item, it must abort decoding to prevent displaying incorrectly transformed, cropped, or rotated imagery.
Malformed Files vs. Unknown Extensions
Standard AVIF parsing distinguishes between unknown boxes and syntactically malformed boxes:
- Valid unknown boxes: An unrecognized FourCC with a
valid
sizevalue that correctly aligns with parent boundaries is simply ignored. - Malformed boxes: If the box size extends past the end of the file or exceeds the boundaries of its parent container box, the parser treats the file as corrupted and rejects it to prevent buffer overruns or infinite loops.