How to Check AVIF Chroma Subsampling (4:2:0 or 4:4:4)

This guide explains how developers can inspect an AVIF image to determine its chroma subsampling scheme, specifically distinguishing between 4:2:0 and 4:4:4 formats. Because AVIF relies on the AV1 video codec packaged inside an ISOBMFF container, standard image viewers often hide color layout details. You will learn how to verify subsampling data using command-line utilities such as FFprobe, avifdec, and ExifTool.

1. Using FFprobe (FFmpeg)

FFprobe provides a reliable way to inspect the internal pixel format of an AVIF file. It reports the AV1 video stream's pixel format directly.

Run the following command:

ffprobe -v error -select_streams v:0 -show_entries stream=pix_fmt -of default=noprint_wrappers=1:nokey=1 image.avif

Interpretation:

2. Using avifdec (libavif)

The official reference library for AVIF, libavif, includes a command-line tool named avifdec. It offers an --info flag that reads container metadata without fully decoding the image pixels.

Run the following command:

avifdec --info image.avif

Look for the Format line in the output:

3. Using ExifTool

Phil Harvey's ExifTool parses ISOBMFF box structures directly and extracts color configuration records, such as the av1C (AV1 Configuration Box) or colr boxes.

Run the following command:

exiftool -ChromaSubsampling image.avif

Alternatively, to view all color-related tags:

exiftool -s -G image.avif | grep -i subsampling

Interpretation:

4. Inspecting via Node.js (image-size or sharp)

If you need to inspect files programmatically in JavaScript or TypeScript, you can use the sharp library:

const sharp = require('sharp');

async function checkSubsampling(filePath) {
  const metadata = await sharp(filePath).metadata();
  console.log(`Chroma Subsampling: ${metadata.chromaSubsampling}`);
}

checkSubsampling('image.avif');

Sharp will return strings such as '4:2:0' or '4:4:4' within the metadata object.