2

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?

1 Answer 1

2

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.

5
  • 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
    Sep 18, 2018 at 7:45
  • Replace -f rawvideo raw.rgb with out.tiff
    – Gyan
    Sep 18, 2018 at 9:02
  • 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
    Sep 18, 2018 at 10:36
  • Can your app only read TIFFs?
    – Gyan
    Sep 18, 2018 at 16:22
  • I am writing a python program to read the RGB values from the 10-bit HDR video. I was planning to convert the video to a number of images and read the 10-bit RGB values. Initially I thought tiff can store 16-bit values so it is suitable to store the 10-bit HDR frames. Unfortunately ffmpeg does not seem have tiff codec to support the gbrp10be format. Any alternative suggestions are welcome as long as I can read the 10-bit RGB values from the HDR video.
    – chesschi
    Sep 19, 2018 at 3:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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