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=1might be redundant (or ignored)- If
--cicpis ignored and the source image doesn't specify any profile,2/2/6is used where2means unspecified. This is okay for sRGB.
Sources:
- https://github.com/AOMediaCodec/libavif/wiki/CICP
- https://en.wikipedia.org/wiki/Coding-independent_code_points
- https://old.reddit.com/r/AV1/comments/o7s8hk/high_quality_encoding_of_avif_images_using/
- https://wiki.x266.mov/docs/encoders/aomenc#avif-encoding
- (av1 video) https://www.reddit.com/r/AV1/comments/t59j32/encoder_tuning_part_4_a_2nd_generation_guide_to/
- (av1 video) https://gist.github.com/nico-lab/a6508f283a77696e79a131e07abd86b9