Extracting frames from HDR video to PNG format - question about PQ nonlinearity

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Extracting frames from HDR video to PNG format - question about PQ nonlinearity

m.kudelski@wp.pl
Dear ffmpeg Team and Users,  I have an input video file in HDR format (BT.2020 colors, PQ transfer function according to SMPTE ST 2084; more details attached below). I am extracting frames to 16-bit PNG files using the following command:   ffmpeg -i <input> -pix_fmt rgb48be -s:v 1920x1080 -color_primaries 9 -color_trc 16 -colorspace 9 -color_range 1 ../frame_%06d.png   The info about an example output PNG file is also attached below.   My question is: what is the "nonlinearity" of the data in my output PNG file?  What I need to do is to linearize the RGB data from the PNG file (for further processing). Should I assume that:  a) I need to execute the "de-gamma" transform as for typical sRGB data (as in  en.wikipedia.org en.wikipedia.org )   or:  b) I need to execute the "de-2084" transform (using appropriate PQ (perceptual quantizer) equations)  or:  c) other?   In other words, how ffmpeg works in this case:  a) does it transform the ST 2084 PQ-based nonlinearity (input video) into sRGB gamma-based nonlinearity (output PNG)?  or:  b) does it simply put ST 2084 PQ-based nonlinear data into the output PNG file (without changing the nonlinearity)?  or:  c) other?   Any information is welcome. Any reference to the documentation or the source code is very welcome :-)   Thanks in advance and regards,  Michal   ADDITIONAL INFORMATION:  ==============================  HDR video file info (acquired with 'mediainfo' command, filtered):  ==============================  Format : HEVC  Format/Info : High Efficiency Video Coding  Format profile : Main 10@L5.1@High  HDR format : SMPTE ST 2086, HDR10 compatible  Codec ID : V_MPEGH/ISO/HEVC  Bit rate : 52.7 Mb/s  Frame rate : 23.976 (24000/1001) FPS  Color space : YUV  Chroma subsampling : 4:2:0 (Type 2)  Bit depth : 10 bits  Color range : Limited  Color primaries : BT.2020  Transfer characteristics : PQ  Matrix coefficients : BT.2020 non-constant   ==============================  Output PNG file info (acquired with 'identify -verbose' command)  ==============================  Image: HP_003240.png    Format: PNG (Portable Network Graphics)    Mime type: image/png    Class: DirectClass    Geometry: 1920x1080+0+0    Units: Undefined    Colorspace: sRGB    Type: TrueColor    Base type: Undefined    Endianess: Undefined    Depth: 16-bit    Channel depth:      Red: 16-bit      Green: 16-bit      Blue: 16-bit    Channel statistics:      Pixels: 2073600      Red:        min: 0  (0)        max: 37661 (0.57467)        mean: 8491.55 (0.129573)        standard deviation: 7453.65 (0.113735)        kurtosis: -1.04893        skewness: 0.435634        entropy: 0.776201      Green:        min: 0  (0)        max: 38149 (0.582116)        mean: 8885.71 (0.135587)        standard deviation: 7841.78 (0.119658)        kurtosis: -1.12391        skewness: 0.418303        entropy: 0.77953      Blue:        min: 0  (0)        max: 38345 (0.585107)        mean: 9488.9 (0.144791)        standard deviation: 8624.84 (0.131607)        kurtosis: -1.06718        skewness: 0.498124        entropy: 0.78175    Image statistics:      Overall:        min: 0  (0)        max: 38345 (0.585107)        mean: 8955.39 (0.13665)        standard deviation: 7973.43 (0.121667)        kurtosis: -1.02099        skewness: 0.475895        entropy: 0.77916    Rendering intent: Perceptual    Gamma: 0.454545    Chromaticity:      red primary: (0.64,0.33)      green primary: (0.3,0.6)      blue primary: (0.15,0.06)      white point: (0.3127,0.329)    Matte color: grey74    Background color: white    Border color: srgb(223,223,223)    Transparent color: none    Interlace: None    Intensity: Undefined    Compose: Over    Page geometry: 1920x1080+0+0    Dispose: Undefined    Iterations: 0    Compression: Zip    Orientation: Undefined    Properties:      date:create: 2019-10-28T11:22:07+01:00      date:modify: 2019-10-25T20:20:32+02:00      png:IHDR.bit-depth-orig: 16      png:IHDR.bit_depth: 16      png:IHDR.color-type-orig: 2      png:IHDR.color_type: 2 (Truecolor)      png:IHDR.interlace_method: 0 (Not interlaced)      png:IHDR.width,height: 1920, 1080      png:pHYs: x_res=0, y_res=1, units=0      png:sRGB: intent=0 (Perceptual Intent)      signature: c6850dd1d1e52091ea76c987a99a52    Artifacts:      verbose: true    Tainted: False    Filesize: 8.2234MiB    Number pixels: 2073600    Pixels per second: 4.06588MP    User time: 0.210u    Elapsed time: 0:01.509    Version: ImageMagick 7.0.8-12 Q16 x86_64 2018-09-25  imagemagick.org imagemagick.org  ==============================  ==============================
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Extracting frames from HDR video to PNG format - question about PQ nonlinearity

FFmpeg-users mailing list
 

    On Thursday, January 23, 2020, 03:08:26 AM PST, [hidden email] <[hidden email]> wrote:  
 
 Dear ffmpeg Team and Users,  I have an input video file in HDR format (BT.2020 colors, PQ transfer function according to SMPTE ST 2084; more details attached below). I am extracting frames to 16-bit PNG files using the following command:  ffmpeg -i &lt;input&gt; -pix_fmt rgb48be -s:v 1920x1080 -color_primaries 9 -color_trc 16 -colorspace 9 -color_range 1 ../frame_%06d.png  The info about an example output PNG file is also attached below.  My question is: what is the "nonlinearity" of the data in my output PNG file?  What I need to do is to linearize the RGB data from the PNG file (for further processing). Should I assume that:  a) I need to execute the "de-gamma" transform as for typical sRGB data (as in  en.wikipedia.org en.wikipedia.org )   or:  b) I need to execute the "de-2084" transform (using appropriate PQ (perceptual quantizer) equations)  or:  c) other?  In other words, how ffmpeg works in this case:  a) does it transform the ST 2084 PQ-based nonlinearity (input video) into sRGB gamma-based nonlinearity (output PNG)?  or:  b) does it simply put ST 2084 PQ-based nonlinear data into the output PNG file (without changing the nonlinearity)?  or:  c) other?  Any information is welcome. Any reference to the documentation or the source code is very welcome :-)  Thanks in advance and regards,  Michal  ADDITIONAL INFORMATION:  ==============================  HDR video file info (acquired with 'mediainfo' command, filtered):  ==============================  Format : HEVC  Format/Info : High Efficiency Video Coding  Format profile : Main 10@L5.1@High  HDR format : SMPTE ST 2086, HDR10 compatible  Codec ID : V_MPEGH/ISO/HEVC  Bit rate : 52.7 Mb/s  Frame rate : 23.976 (24000/1001) FPS  Color space : YUV  Chroma subsampling : 4:2:0 (Type 2)  Bit depth : 10 bits  Color range : Limited  Color primaries : BT.2020  Transfer characteristics : PQ  Matrix coefficients : BT.2020 non-constant  ==============================  Output PNG file info (acquired with 'identify -verbose' command)  ==============================  Image: HP_003240.png    Format: PNG (Portable Network Graphics)    Mime type: image/png    Class: DirectClass    Geometry: 1920x1080+0+0    Units: Undefined    Colorspace: sRGB    Type: TrueColor    Base type: Undefined    Endianess: Undefined    Depth: 16-bit    Channel depth:      Red: 16-bit      Green: 16-bit      Blue: 16-bit    Channel statistics:      Pixels: 2073600      Red:        min: 0  (0)        max: 37661 (0.57467)        mean: 8491.55 (0.129573)        standard deviation: 7453.65 (0.113735)        kurtosis: -1.04893        skewness: 0.435634        entropy: 0.776201      Green:        min: 0  (0)        max: 38149 (0.582116)        mean: 8885.71 (0.135587)        standard deviation: 7841.78 (0.119658)        kurtosis: -1.12391        skewness: 0.418303        entropy: 0.77953      Blue:        min: 0  (0)        max: 38345 (0.585107)        mean: 9488.9 (0.144791)        standard deviation: 8624.84 (0.131607)        kurtosis: -1.06718        skewness: 0.498124        entropy: 0.78175    Image statistics:      Overall:        min: 0  (0)        max: 38345 (0.585107)        mean: 8955.39 (0.13665)        standard deviation: 7973.43 (0.121667)        kurtosis: -1.02099        skewness: 0.475895        entropy: 0.77916    Rendering intent: Perceptual    Gamma: 0.454545    Chromaticity:      red primary: (0.64,0.33)      green primary: (0.3,0.6)      blue primary: (0.15,0.06)      white point: (0.3127,0.329)    Matte color: grey74    Background color: white    Border color: srgb(223,223,223)    Transparent color: none    Interlace: None    Intensity: Undefined    Compose: Over    Page geometry: 1920x1080+0+0    Dispose: Undefined    Iterations: 0    Compression: Zip    Orientation: Undefined    Properties:      date:create: 2019-10-28T11:22:07+01:00      date:modify: 2019-10-25T20:20:32+02:00      png:IHDR.bit-depth-orig: 16      png:IHDR.bit_depth: 16      png:IHDR.color-type-orig: 2      png:IHDR.color_type: 2 (Truecolor)      png:IHDR.interlace_method: 0 (Not interlaced)      png:IHDR.width,height: 1920, 1080      png:pHYs: x_res=0, y_res=1, units=0      png:sRGB: intent=0 (Perceptual Intent)      signature: c6850dd1d1e52091ea76c987a99a52    Artifacts:      verbose: true    Tainted: False    Filesize: 8.2234MiB    Number pixels: 2073600    Pixels per second: 4.06588MP    User time: 0.210u    Elapsed time: 0:01.509    Version: ImageMagick 7.0.8-12 Q16 x86_64 2018-09-25  imagemagick.org imagemagick.org  ==============================  ==============================
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".  
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".