01.05.2024, 00:09
Unfortunately this fix is not enough
Using your script I obtain the following image:
![[Image: attachment.php?aid=2434]](https://forum.selur.net/attachment.php?aid=2434)
That is better but not equal to "native" RGB24 version
Using the following script
In this case I removed the final conversion to limited, and the picture obtained is a little better
![[Image: attachment.php?aid=2435]](https://forum.selur.net/attachment.php?aid=2435)
But to get the exact picture I need to used the same conditions as in the following script
In this case I obtain the following picture
![[Image: attachment.php?aid=2436]](https://forum.selur.net/attachment.php?aid=2436)
To simplify the comparison I created this album: https://imgsli.com/MjYwNDcy
Dan
Using your script I obtain the following image:
That is better but not equal to "native" RGB24 version
Using the following script
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'D:/Programs/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="D:/Programs/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import validate
# Source: 'TestClipSingerBW.mp4'
# Current color space: YUV420P8, bit depth: 8, resolution: 480x360, frame rate: 25fps, scanorder: progressive, yuv luminance scale: limited, matrix: 470bg
# Loading TestClipSingerBW.mp4 using LWLibavSource
clip = core.lsmas.LWLibavSource(source="TestClipSingerBW.mp4", format="YUV420P8", stream_index=0, cache=0, fpsnum=25, prefer_hw=0)
clip = core.std.Loop(clip=clip[185], times=257)
frame = clip.get_frame(0)
# Setting detected color matrix (470bg).
clip = core.std.SetFrameProps(clip, _Matrix=5)
# setting color transfer (170), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip, _Transfer=6)
# setting color primaries info (to 470), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip, _Primaries=5)
clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
# setting color range to PC (full) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=0)
# making sure frame rate is set to 25fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# making sure the detected scan type is set (detected: progressive)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
# adjusting color space from YUV420P8 to RGB24 for vsDeOldify
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="full")
# adding colors using DeOldify
from vsdeoldify import ddeoldify
clip = ddeoldify(clip=clip, method=0, deoldify_p=[0, 24, 1, 0])
# adjusting output color from: RGB24 to YUV420P10 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="470bg", range_s="full")
# set output frame rate to 25fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# output
clip.set_output()
In this case I removed the final conversion to limited, and the picture obtained is a little better
But to get the exact picture I need to used the same conditions as in the following script
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'D:/Programs/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="D:/Programs/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import validate
# Source: 'TestClipSingerBW.mp4'
# Current color space: YUV420P8, bit depth: 8, resolution: 480x360, frame rate: 25fps, scanorder: progressive, yuv luminance scale: limited, matrix: 470bg
# Loading TestClipSingerBW.mp4 using LWLibavSource
clip = core.lsmas.LWLibavSource(source="TestClipSingerBW.mp4", format="YUV420P8", stream_index=0, cache=0, fpsnum=25, prefer_hw=0)
clip = core.resize.Bicubic(clip=clip, matrix_in_s="470bg", matrix_s="709", range_in=0, range=0)
# changing range from limited to full range
clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
clip = core.std.Loop(clip=clip[185], times=257)
frame = clip.get_frame(0)
# Setting detected color matrix (709).
clip = core.std.SetFrameProps(clip, _Matrix=1)
# setting color transfer (170), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip, _Transfer=1)
# setting color primaries info (to 709), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip, _Primaries=1)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
# making sure frame rate is set to 25fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# making sure the detected scan type is set (detected: progressive)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
# changing range from limited to full range
#clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
# setting color range to PC (full) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=0)
# adjusting color space from YUV420P8 to RGB24 for vsDeOldify
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_s="full", dither_type="error_diffusion")
# adding colors using DeOldify
from vsdeoldify import ddeoldify
clip = ddeoldify(clip=clip, method=0, deoldify_p=[0, 24, 1, 0])
# changing range from full to limited range
#clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
# adjusting output color from: RGB24 to YUV420P10 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="709", range_s="full")
# set output frame rate to 25fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# output
clip.set_output()
In this case I obtain the following picture
To simplify the comparison I created this album: https://imgsli.com/MjYwNDcy
Dan