Selur's Little Message Board

Full Version: Deoldify Vapoursynth filter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import vsdeoldify as havc
import validate
# Source: 'E:\old\test.ts'
# Current color space: YUV420P8, bit depth: 8, resolution: 1280x720, frame rate: 25fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709, format: avc
# Loading E:\old\test.ts using LWLibavSource
clip = core.lsmas.LWLibavSource(source="E:/old/test.ts", format="YUV420P8", stream_index=1, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# setting color matrix to 709.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
# setting color transfer (vs.TRANSFER_BT709), if it is not set.
if validate.transferIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
# setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
if validate.primariesIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
# 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=vs.FIELD_PROGRESSIVE) # progressive
original = clip
# adjusting color space from YUV420P8 to RGB24 for vsHAVC
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_in_s="limited", range_s="full")
# adding colors using HAVC
clip = havc.HAVC_main(clip, EnableDeepEx=True, DeepExMethod=3, ScFrameDir="E:/old/new colour/test colour", ScNormalize=True, DeepExModel=0, DeepExEncMode=0, DeepExMaxMemFrames=0)
# adjusting output color from: RGB24 to YUV420P8 for x264Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="709", range_in_s="full", range_s="limited") # additional resize to allow target color sampling
original = core.text.Text(clip=original,text="Original",scale=1,alignment=7)
clip = core.text.Text(clip=clip,text="Filtered",scale=1,alignment=7)
stacked = core.std.StackHorizontal([original,clip])
# set output frame rate to 25fps (progressive)
stacked = core.std.AssumeFPS(clip=stacked, fpsnum=25, fpsden=1)
# output
stacked.set_output()
It is a bug introduced in the main release v5.6.0. 
To fix it I just released the new HAVC v5.6.2

Dan
Started uploading a VapoursynthR72_torch_2025.11.12 which comes with this version, should be available in ~60min. (Update:is up now)

Cu Selur
reffernce based colorization simply  working super . 

https://www.jioaicloud.com/l/?u=_YgrdUCM...HVKTS5chkW

in this video left side video original frames 5000, right side video reffernce  based colorization only 250 frames.

Thanks to  Selur  and  Dan64
colour shifted to up side


https://gofile.io/d/UvhXiP
What does the Vapoursynth script look like?
no errors found. but colour shifted to upside . face edge etc...


https://gofile.io/d/t7qQa8
I did not ask about errors,.. What does the Vapoursynth script look like?
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/akarin.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import chromaBleeding
import vsdeoldify as havc
import validate
# Source: 'C:\Users\Halloman\Desktop\Mayabazar Movie\Mayabazar  B&W.mp4'
# Current color space: YUV420P8, bit depth: 8, resolution: 1280x720, frame rate: 29.97fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709, format: AVC
# Loading 'C:\Users\Halloman\Desktop\Mayabazar Movie\Mayabazar  B&W.mp4Ä using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Halloman/Desktop/Mayabazar Movie/Mayabazar  B&W.mp4", format="YUV420P8", stream_index=1, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# setting color matrix to 709.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
# setting color transfer (vs.TRANSFER_BT709), if it is not set.
if validate.transferIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
# setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
if validate.primariesIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
# making sure frame rate is set to 29.97fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# making sure the detected scan type is set (detected: progressive)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
original = clip
# adjusting color space from YUV420P8 to RGB24 for vsHAVC
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_in_s="limited", range_s="full")
# adding colors using HAVC
clip = havc.HAVC_main(clip, ColorTune="medium", EnableDeepEx=True, DeepExMethod=3, DeepExPreset="slow", ScFrameDir="C:/Users/Halloman/Desktop/Mayabazar Movie/reff", DeepExModel=0, DeepExEncMode=0, DeepExMaxMemFrames=0)
# adjusting color space from RGB24 to YUV444P16 for vsFixChromaBleeding
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="709", range_in_s="full", range_s="limited") # additional resize to match target color sampling
# Fixing chroma bleeding using FixChromaBleedingMod
clip = chromaBleeding.FixChromaBleedingMod(clip, blur=True)
# adjusting output color from YUV444P16 to YUV420P8 for x264Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, dither_type="error_diffusion")
original = core.text.Text(clip=original,text="Original",scale=1,alignment=7)
clip = core.text.Text(clip=clip,text="Filtered",scale=1,alignment=7)
stacked = core.std.StackHorizontal([original,clip])
# set output frame rate to 29.97fps (progressive)
stacked = core.std.AssumeFPS(clip=stacked, fpsnum=30000, fpsden=1001)
# output
stacked.set_output()







https://gofile.io/d/t7qQa8
  • use 'code'-tags
  • that is the script of the Vapoursynth Preview Script, not the Vapoursynth Script, use the Vapoursynth Script View.
  • the screenshot you post does not match the script
For testing, assuming you properly cropped your source to not include black bars:
Does it work if you crop your source to be mod16 in width&height (before applying HAVC)?

Cu Selur