Skip to content

Instantly share code, notes, and snippets.

@johncf
Last active April 9, 2025 07:24
Show Gist options
  • Select an option

  • Save johncf/7e18feee6acd717d72d87b7b9b5111a1 to your computer and use it in GitHub Desktop.

Select an option

Save johncf/7e18feee6acd717d72d87b7b9b5111a1 to your computer and use it in GitHub Desktop.
AVIF with HDR and CICP (Coding-Independent Code Points) settings

To convert an HDR PNG that's exported with HLG transfer function in Rec. 2020 color space, do:

avifenc -s 4 -j 4 --min 1 --max 56 -a end-usage=q -a cq-level=18 -a color:deltaq-mode=1 -a tune=ssim \
    -a color:enable-chroma-deltaq=1 -a color:enable-qm=1 -d 12 --cicp 9/18/9 IMG_0186.png IMG_0186.avif

For HDR with PQ transfer function in Rec. 2020 color space, do:

avifenc -s 4 -j 4 --min 1 --max 56 -a end-usage=q -a cq-level=18 -a color:deltaq-mode=1 -a tune=ssim \
    -a color:enable-chroma-deltaq=1 -a color:enable-qm=1 -d 12 --cicp 9/16/9 IMG_0186.png IMG_0186.avif

For the default SDR image (sRGB with BT.601 coefficients), simply do:

avifenc -s 4 -j 4 --min 1 --max 56 -a end-usage=q -a cq-level=18 -a color:deltaq-mode=1 -a tune=ssim \
    -a color:enable-chroma-deltaq=1 -a color:enable-qm=1 --cicp 1/13/6 IMG_0186.png IMG_0186.avif

For the same with BT.709 coefficients, do:

avifenc -s 4 -j 4 --min 1 --max 56 -a end-usage=q -a cq-level=18 -a color:deltaq-mode=1 -a tune=ssim \
    -a color:enable-chroma-deltaq=1 -a color:enable-qm=1 --cicp 1/13/1 IMG_0186.png IMG_0186.avif

Notes:

  • -a color:deltaq-mode=1 might be redundant (or ignored)
  • If --cicp is ignored and the source image doesn't specify any profile, 2/2/6 is used where 2 means unspecified. This is okay for sRGB.

Sources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment