We map out where things change between the creation of an HDR file and the moment it appears on screen, and take another look at the transfer functions from Chapter 1 with a practitioner's eye.
In Chapter 1 you learned that a codec doesn't "compress" HDR. A codec only compresses numbers, and it's the tags (metadata) that tell you whether those numbers are PQ or HLG. This chapter covers how to attach those tags to a real file correctly, how not to lose them, and how to convert down to SDR when you need to.
The numbers are the same CICP trio from Chapter 1. Rather than memorizing the values, get in the habit of reading them with ffprobe.
Almost every HDR accident is a case where the pixels are fine but the interpretation is off. So make it a habit to check color_primaries / color_transfer / color_space with ffprobe at the end of every step. You can also view a file's current tags with the File Info Inspector tool.
The flow from mastering → export → encoding → distribution → playback. The color tags have to survive every step.
In ffmpeg options and ffprobe output, PQ is written smpte2084 and HLG is written arib-std-b67.
Where in an HDR file is the PQ/HLG distinction recorded?