Answers.Body: <p>The ProRes input will have YUV encoding, not RGB. If you need a raw dump, save as rawvideo.</p>
  
  <pre><code>ffmpeg -i in.mov -f rawvideo raw.yuv
  </code></pre>
  
  <p>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 <code>1110101100</code> but will be stored as 16 bits in the file: <code>1110110000000011</code> where the order is little-endian.</p>
  
  <p>You can however save as RGB 10-bit (with padding),</p>
  
  <pre><code>ffmpeg -i in.mov -pix_fmt gbrp10be -f rawvideo raw.rgb
  </code></pre>
  
  <p>where the green plane is stored first, then blue, then red. The above is for big-endian so the byte order isn't reversed.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-18T07:45:26.543Z
Answers.Text: 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`
Answers.UserDisplayName: chesschi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-18T09:02:12.730Z
Answers.Text: Replace `-f rawvideo raw.rgb` with `out.tiff`
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-18T10:36:55.247Z
Answers.Text: 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.
Answers.UserDisplayName: chesschi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-18T16:22:20.157Z
Answers.Text: Can your app only read TIFFs?
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-19T03:56:24.187Z
Answers.Text: 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.
Answers.UserDisplayName: chesschi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-14T09:05:57.657Z
Answers.LastActivityDate: 2018-09-14T09:05:57.657Z
Answers.UserDisplayName: Gyan
Body: <p>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.</p>
  
  <p>As per <a href="https://video.stackexchange.com/questions/22136/convert-video-to-10-bit-images">this</a> 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?</p>
  
Tags: <video><ffmpeg><conversion><color><hdr>
Title: How to read 10-bit RGB values from HDR video?
UserDisplayName: chesschi
ThreadText: # How to read 10-bit RGB values from HDR video?
  
  (Asked by: username_0 on 2018-09-14)
  
  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](https://video.stackexchange.com/questions/22136/convert-video-to-10-bit-images) 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?
  
  **Tags:** video, ffmpeg, conversion, color, hdr
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-09-14. Score: 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.
  
  > **Comments:**
  > **username_0**: 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`  
  > **username_1**: Replace `-f rawvideo raw.rgb` with `out.tiff`  
  > **username_0**: 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.  
  > **username_1**: Can your app only read TIFFs?  
  > **username_0**: 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.  
  
  ---
  
  