I had a HDR video and the format is ProRes. The colour bit depth of ProRes is 10-bit. I would like to extract the 10-bit RGB values from the HDR video.

As per this link, I have first converted the 10-bit HDR video to a number of 16-bit TIFF images. However, when I use some program like python to read back the RGB values from the TIFF image, some of the 16-bit RGB values are larger than 1024 (=2^10). It looks to me the 10-bit RGB value has been expanded to 16-bit and store the expanded value in the TIFF image but I am not sure if that is the case. How can I obtain the original 10-bit RGB values from the 16-bit RGB values stored in the TIFF image?

New contributor
chesschi is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

The ProRes input will have YUV encoding, not RGB. If you need a raw dump, save as rawvideo.

ffmpeg -i in.mov -f rawvideo raw.yuv

Note that bit depths which aren't multiples of 8 are still stored in data layouts which are, with padding. So, if ProRes is yuv422p10le in limited / studio range, the 10-bit luma value for a white pixel will be 940 or 1110101100 but will be stored as 16 bits in the file: 1110110000000011 where the order is little-endian.

You can however save as RGB 10-bit (with padding),

ffmpeg -i in.mov -pix_fmt gbrp10be -f rawvideo raw.rgb

where the green plane is stored first, then blue, then red. The above is for big-endian so the byte order isn't reversed.

  • Sorry for the late reply. If I use the second ffmpeg command to convert the file with the RGB 10-bit format as 'raw.rgb', how can I then convert 'raw.rgb' to TIFF image? I have tried ffmpeg -f rawvideo -pix_fmt gbrp10be -i raw.rgb -f image2 img%05d.tif but it complains [IMGUTILS @ 015ff914] Picture size 0x0 is invalid raw.rgb: Invalid argument – chesschi 6 hours ago
  • Replace -f rawvideo raw.rgb with out.tiff – Gyan 5 hours ago
  • It will show the following warning Incompatible pixel format 'gbrp10be' for codec 'tiff', auto-selecting format 'rgb48le' and I have used the python program to read the images but the values are not 10-bit. – chesschi 3 hours ago

Your Answer

chesschi is a new contributor. Be nice, and check out our Code of Conduct.
 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.