2019-05-04, 12:21 AM
After a while, I've found some ways to convert HDR 10bit bt.2020 video to SDR 8bit bt.709
Don't know which is better, so if anyone, after have tried them, want to chime in, it will help!
Script 1A
Script 1B:
Script 2:
Don't know which is better, so if anyone, after have tried them, want to chime in, it will help!
Script 1A
Code:
#Indexing
FFVideoSource("any_HDR_video.mkv")
#From 10bit to 16bit
ConvertBits(16)
#Reverse upscale to FULL HD with 16bit precision
#(optional)
#DeBilinearResizeMT(1920, 1080)
#From YUV to XYZ with 16bit precision
ConvertYUVtoXYZ(Color=0, OutputMode=1, HDRMode=0, fullrange=false)
#Tone-mapping with 16bit precision
#(of course values could/should? be changed)
ConvertXYZ_Reinhard_HDRtoSDR(exposure_X=14.0, contrast_X=0.5, exposure_Y=14.0, contrast_Y=0.5, exposure_Z=14.0, contrast_Z=0.5)
#From XYZ back to YUV 4:4:4 with 16bit precision
ConvertXYZtoYUV(pColor=0)
#Converting back to 4:2:0 with 16bit precision
Converttoyuv420(interlaced=false, matrix="Rec.709")
#Dithering to 8bit with the Floyd-Steinberg error diffusion
ConvertBits(bits=8, dither=1)
#Clipping
Limiter(min_luma=16, max_luma=235, min_chroma=16, max_chroma=240)
Script 1B:
Code:
#Indexing
FFVideoSource("any_HDR_video.mkv")
#From 10bit to 16bit
ConvertBits(16)
#Reverse upscale to FULL HD with 16bit precision
#(optional)
#DeBilinearResizeMT(1920, 1080)
#From YUV to XYZ with 16bit precision
ConvertYUVtoXYZ(Color=0, OutputMode=1, HDRMode=0, fullrange=false)
#Tone-mapping with 16bit precision
#(of course values could/should? be changed)
ConvertXYZ_Reinhard_HDRtoSDR(exposure_X=14.0, contrast_X=0.5, exposure_Y=14.0, contrast_Y=0.5, exposure_Z=14.0, contrast_Z=0.5)
#From XYZ back to YUV 4:4:4 with 16bit precision
ConvertXYZtoYUV(pColor=0)
#Converting back to 4:2:0
Converttoyv12(matrix="PC709")
#From 16bit to 8bit
ConvertTo8bit
#Clipping (needed?)
Limiter(min_luma=16, max_luma=235, min_chroma=16, max_chroma=240)
Script 2:
Code:
FFVideoSource("any_HDR_video.mkv")
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l", dither_type="none")
DGHable
# you can always play with the exposure:
# DGHable(exposure=1.0)
# (replace 1.0 with your own value)
# Reinhard could also be used:
# DGReinhard
z_ConvertFormat(pixel_type="YV12",colorspace_op="rgb:linear:2020:l=>709:709:709:l",dither_type="ordered")