Selur
14th March 2018, 01:15
when using:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="G:/Hybrid/64bit/vsfilters/ColorFilter/ToneMap/tonemap.dll")
core.std.LoadPlugin(path="G:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading C:\Users\Selur\Desktop\Sample2.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/Sample2.mkv", format="YUV420P10", cache=0)
# making sure input color matrix is set as 2020ncl
clip = core.resize.Point(clip, matrix_in_s="2020ncl")
# making sure frame rate is set to 24000/1001
clip = core.std.AssumeFPS(clip, fpsnum=24000, fpsden=1001)
# Making sure input color range is set to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjustmentint bit depth for ToneMap
clip = core.fmtc.bitdepth(clip, bits=32)
# color adjustment using ToneMap
clip = core.tonemap.Hable(clip=clip)
clip = core.resize.Bilinear(clip=clip, format=vs.YUV420P8, matrix_s="709", matrix_in_s="2020ncl", range_in_s="full",range_s="limited")
# resizing clip to 1920x1080
clip = core.fmtc.resample(clip=clip, kernel="spline16", w=1920, h=1080, interlaced=False, interlacedd=False)
# adjusting output color from: YUV420P16 to YUV420P8 for x264Model (i420)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8)
# Output
clip.set_output()
I get color artifacts, especially visible at frame 190+
short sample of the source: Sample2.mkv (https://drive.google.com/drive/folders/0B_WxUS1XGCPAUTlILW54VThMTFU?usp=sharing).
(using FFMS2 doesn't help, using the HDR to SDR script from https://forum.doom9.org/showthread.php?p=1800675 doesn't produce these artifacts, but since tonemap is quite a bit faster I would prefer using tonemap)
-> Is this a bug in ToneMap or is there something wrong with the source?
Problem also seems to only occur when using 'Hable', 'Mobius' and 'Reinhard' don't seem to have the problem.
Using tonemap from ffmpeg directly without Vapoursynth doesn't cause the problem.
ffmpeg -y -loglevel fatal -threads 8 -i "C:\Users\Selur\Desktop\Sample2.mkv" -map 0:0 -an -sn -vf zscale=tin=smpte2084:min=bt2020nc:pin=bt2020:rin=limited:t=smpte2084:m=bt2020nc:p=bt2020:r=tv,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=clip:desat=2.000:peak=0.000,zscale=t=bt709:m=bt709:r=tv,scale=1920:1080 -vsync 0 -pix_fmt yuv420p -sws_flags spline -f rawvideo -
so this might be a but in the toneMap Vapoursynth port.
-> added an issue to the bug tracker (https://github.com/ifb/vapoursynth-tonemap/issues/3)
Didn't notice that I didn't use hable with ffmpeg -> using hable as method with ffmpeg the problem doesn't appear.
Cu Selur
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="G:/Hybrid/64bit/vsfilters/ColorFilter/ToneMap/tonemap.dll")
core.std.LoadPlugin(path="G:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading C:\Users\Selur\Desktop\Sample2.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/Sample2.mkv", format="YUV420P10", cache=0)
# making sure input color matrix is set as 2020ncl
clip = core.resize.Point(clip, matrix_in_s="2020ncl")
# making sure frame rate is set to 24000/1001
clip = core.std.AssumeFPS(clip, fpsnum=24000, fpsden=1001)
# Making sure input color range is set to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjustmentint bit depth for ToneMap
clip = core.fmtc.bitdepth(clip, bits=32)
# color adjustment using ToneMap
clip = core.tonemap.Hable(clip=clip)
clip = core.resize.Bilinear(clip=clip, format=vs.YUV420P8, matrix_s="709", matrix_in_s="2020ncl", range_in_s="full",range_s="limited")
# resizing clip to 1920x1080
clip = core.fmtc.resample(clip=clip, kernel="spline16", w=1920, h=1080, interlaced=False, interlacedd=False)
# adjusting output color from: YUV420P16 to YUV420P8 for x264Model (i420)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8)
# Output
clip.set_output()
I get color artifacts, especially visible at frame 190+
short sample of the source: Sample2.mkv (https://drive.google.com/drive/folders/0B_WxUS1XGCPAUTlILW54VThMTFU?usp=sharing).
(using FFMS2 doesn't help, using the HDR to SDR script from https://forum.doom9.org/showthread.php?p=1800675 doesn't produce these artifacts, but since tonemap is quite a bit faster I would prefer using tonemap)
-> Is this a bug in ToneMap or is there something wrong with the source?
Problem also seems to only occur when using 'Hable', 'Mobius' and 'Reinhard' don't seem to have the problem.
Using tonemap from ffmpeg directly without Vapoursynth doesn't cause the problem.
ffmpeg -y -loglevel fatal -threads 8 -i "C:\Users\Selur\Desktop\Sample2.mkv" -map 0:0 -an -sn -vf zscale=tin=smpte2084:min=bt2020nc:pin=bt2020:rin=limited:t=smpte2084:m=bt2020nc:p=bt2020:r=tv,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=clip:desat=2.000:peak=0.000,zscale=t=bt709:m=bt709:r=tv,scale=1920:1080 -vsync 0 -pix_fmt yuv420p -sws_flags spline -f rawvideo -
so this might be a but in the toneMap Vapoursynth port.
-> added an issue to the bug tracker (https://github.com/ifb/vapoursynth-tonemap/issues/3)
Didn't notice that I didn't use hable with ffmpeg -> using hable as method with ffmpeg the problem doesn't appear.
Cu Selur