poisondeathray
28th April 2022, 00:04
Hmm ok so I had to add a couple of parameters to
a) Identify the input primaries as bt2020
and
b) Specify limited range output
This worked great for a TIF input. The output matches the source in Resolve perfectly:
ffmpeg -i HDR_Ramp.tif -vf zscale=w=1920:h=1080:pin=bt2020:p=bt2020:tin=smpte2084:t=linear,format=gbrpf32le,zscale=m=2020_ncl:tin=linear:t=smpte2084:r=limited,format=yuv420p10le -c:v libx265 -crf 10 reference2.mp4
Interesting, I would have thought that in tif without any flags or metadata, pin=bt2020:p=bt2020 should be a no-op and do nothing, and that RGB to YUV limited range would be default setting... But you're right, they are required or the proper flags need to be set
But for current ffmpeg behaviour - it appears is the metadata for primaries in the output file isn't written , unless you set it in the zscale arguments, or the encoder settings. The actual video data is unaffected and still a no-op
Color primaries : BT.2020
(I guess it's better to be explicit and check assumptions)
However, as soon as I swapped over to using the IMF MXF J2K wrapped version of this (same image), I get the same clipped whites:
ffmpeg -f imf -i .\CPL_FOX-TPS-1MIN-HDR10-ML7_20181105_OV.xml -map 0:v -vf zscale=w=1920:h=1080:pin=bt2020:p=bt2020:tin=smpte2084:t=linear,format=gbrpf32le,zscale=m=2020_ncl:tin=linear:t=smpte2084:r=limited,format=yuv420p10le -c:v libx265 -crf 10 -preset superfast -x265-params keyint=24 -t 1 scale_linear_08.mp4
That clipped white is visible both in MPC-HC and in Resolve.
Not sure, there might be other metadata or flags in the imf that overrides some settings or assumptions. what pixel format for the imf ?
You can add -report to the command line and look ath the ffmpeg log for clues
a) Identify the input primaries as bt2020
and
b) Specify limited range output
This worked great for a TIF input. The output matches the source in Resolve perfectly:
ffmpeg -i HDR_Ramp.tif -vf zscale=w=1920:h=1080:pin=bt2020:p=bt2020:tin=smpte2084:t=linear,format=gbrpf32le,zscale=m=2020_ncl:tin=linear:t=smpte2084:r=limited,format=yuv420p10le -c:v libx265 -crf 10 reference2.mp4
Interesting, I would have thought that in tif without any flags or metadata, pin=bt2020:p=bt2020 should be a no-op and do nothing, and that RGB to YUV limited range would be default setting... But you're right, they are required or the proper flags need to be set
But for current ffmpeg behaviour - it appears is the metadata for primaries in the output file isn't written , unless you set it in the zscale arguments, or the encoder settings. The actual video data is unaffected and still a no-op
Color primaries : BT.2020
(I guess it's better to be explicit and check assumptions)
However, as soon as I swapped over to using the IMF MXF J2K wrapped version of this (same image), I get the same clipped whites:
ffmpeg -f imf -i .\CPL_FOX-TPS-1MIN-HDR10-ML7_20181105_OV.xml -map 0:v -vf zscale=w=1920:h=1080:pin=bt2020:p=bt2020:tin=smpte2084:t=linear,format=gbrpf32le,zscale=m=2020_ncl:tin=linear:t=smpte2084:r=limited,format=yuv420p10le -c:v libx265 -crf 10 -preset superfast -x265-params keyint=24 -t 1 scale_linear_08.mp4
That clipped white is visible both in MPC-HC and in Resolve.
Not sure, there might be other metadata or flags in the imf that overrides some settings or assumptions. what pixel format for the imf ?
You can add -report to the command line and look ath the ffmpeg log for clues