转载自doom9论坛
其中‘path/to/file’填写对应的视频文件
注意内存的控制,对4K电影的压制一般会要求极大的内存
import vapoursynth as vs
core = vs.get_core()
c = core.ffms2.Source(source = 'path/to/file')
source_peak=1200 #set manually
c=core.resize.Bilinear(clip=c, format=vs.YUV444PS, range_in_s="limited", range_s="full",chromaloc_in_s="center",dither_type="none")
c=core.resize.Bilinear(clip=c, format=vs.RGBS, matrix_in_s="2020ncl", range_in_s="full",dither_type="none")
c=core.resize.Bilinear(clip=c, format=vs.RGBS, transfer_in_s="st2084", transfer_s="linear",dither_type="none", nominal_luminance=source_peak)
exposure_bias=source_peak/100
#hable/uncharted tone mapping
tm = core.std.Expr(c, expr="x {exposure_bias} * 0.15 x {exposure_bias} * * 0.05 + * 0.004 + x {