Open Koyper opened 3 years ago
Can you describe your source file in more detail?
An HDR AVIF is simply one that signals a wide color gamut and a larger luminance range using a transfer function such as PQ or HLG, and typically is greater than 8 bits per channel (though this is not any hard requirement). Do you already have such an image? Perhaps an image that is known to be BT.2020 PQ, or P3 PQ, or BT.2020 HLG, etc? What format is it in now?
When it is all said and done, if you have the appropriate pixels in the appropriate color profile, it is going to be a combination of --depth
and --cicp
to signal these things in a final AVIF. I'd also recommend using --ignore-icc
so that you can signal these things entirely with CICP.
If your source material is a frame of HDR video, I highly recommend using ffmpeg
to extract whatever frame(s) you want into a .y4m
file and encode that with avifenc
with matching CICP to the source material. There are more details on how to do that here.
Thanks for your detailed reply.
The use case is for an environment image used as a global rendering light source, so the source file would be RGB 32-bit with a linear profile like sRGB IEC61966, like an .exr or .hdr (Radiance HDR - RGBE) image file.
I'm just now absorbing what CICP is, so forgive my noobness. I'm wondering if there is a way to extract an exr/hdr image into a .y4m file? I do have sample images in exr/hdr formats.
These files are large and I would like to be able to ship them compressed as AVIFs.
avifenc
doesn't provide any color conversion (other than simple YUV<->RGB), so going from (effectively) scRGB Linear to BT.2020 PQ would require a different tool.
I don't really recommend another tool of mine (colorist
) for any kind of production usage, but it is capable of reading FP32 linear TIFFs and interpreting them as overranged correctly, and has a good chance at converting them to BT.2020 PQ. If you can convert your FP32 EXRs to FP32 TIFF first, you can try something like:
colorist convert some_fp32_linear_with_a_correct_icc_profile.tiff dst.avif -p bt2020 -g pq -l 10000 --deflum 100
There is more fine-tuning to be had here (encoding quality, speed, etc), but assuming your source data is signaled as FP32 BT709 Linear and (1.0, 1.0, 1.0)
should be interpreted as 100 nits of white, this might get you close. If you don't have a proper ICC profile in the TIFF to signal BT709 Linear @ 100 nits, you can fake it with a combination of the colorist generate
command and --iccin
argument when using colorist convert
.
Can you provide/attach a known-good source file? I don't mind helping you come up with the commandline.
What is the command line format for processing an hdr file or is that not supported? Can you otherwise suggest a procedure to obtain an hdr avif? Thanks.