16.04.2026, 12:52
Thanks Selur! i think I've got it
# defining beforeBiFrost-function - START
def beforeBiFrost(clip):
core.std.LoadPlugin(path=r"C:\Program Files\Hybrid\64bit\vsfilters\DeCrawlFilter\Tcomb\libtcomb.dll")
clip = core.tcomb.TComb(clip, mode=2, fthreshl=4, fthreshc=7, othreshl=5, othreshc=8)
return [clip]
# defining beforeBiFrost-function - END
# defining beforeResize-function - START
def beforeResize(clip):
# width 1280
# height 960
# colormatrix Rec.709
# colorformat YUV420P16
# 1. Manual 2x Upscale
clip = core.resize.Spline36(clip, width=640, height=480, format=vs.YUV420P16)
clip = core.nnedi3cl.NNEDI3CL(clip, field=0, dh=True, nsize=4, nns=4, qual=2)
clip = core.std.Transpose(clip)
clip = core.nnedi3cl.NNEDI3CL(clip, field=0, dh=True, nsize=4, nns=4, qual=2)
clip = core.std.Transpose(clip)
clip = core.resize.Spline36(clip, matrix_in_s="170m", matrix_s="709")
clip = core.std.SetFrameProps(clip, _Matrix=1, _Transfer=1, _Primaries=1, _SARNum=1, _SARDen=1)
# 2. Kill Rainbows (Grayscale)
grey = core.std.ShufflePlanes(clip, 0, 1)
grey = core.resize.Spline36(grey, format=vs.YUV420P16)
# 3. Load Plugin Manually
core.std.LoadPlugin(path=r"C:\Program Files\Hybrid\64bit\vsfilters\Support\RemapFramesVapoursynth.dll")
clip = core.remap.Rfs(clip, grey, mappings="[12255 21450]")
return [clip]
# defining beforeResize-function - END
# Import scripts
import edi_rpow2
import deband
import sharpen
import hysteria
import color
import chromaBleeding
import nnedi3_resample
import smdegrain
import dehalo
import deblock
import qtgmc
import validate
# Source: 'D:\Season 4 disk 2\A1_t00.mkv'
# Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: top field first, yuv luminance scale: limited, matrix: 170m, format: mpeg-2
# Loading 'D:\Season 4 disk 2\A1_t00.mkvÄ using LWLibavSource
clip = core.lsmas.LWLibavSource(source="D:/Season 4 disk 2/A1_t00.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# setting color matrix to 170m.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_ST170_M)
# setting color transfer (vs.TRANSFER_BT601), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
# setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
# 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: top field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
[clip] = beforeBiFrost(clip)
# clip current meta; color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 170m, yuv luminance scale: limited, scanorder: top field first, full height: true
# rainbow removal using BiFrost
clip = core.bifrost.Bifrost(clip, luma_thresh=4.00, variation=20, conservative_mask=True, interlaced=True)
clip2clip = clip
clip2clip = qtgmc.QTGMC(Input=clip2clip, Preset="fast", opencl=True, TFF=False, FPSDivisor=2)
# Deinterlacing using TIVTC
clip = core.tivtc.TFM(clip, clip2=clip2clip)
clip = core.tivtc.TDecimate(clip, mode=1) # new fps: 23.976
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
clip = core.std.Crop(clip, left=10, right=10, top=0, bottom=4) # cropping to 700x476
# applying deblocking using DeBlock QED
clip = deblock.Deblock_QED(clip, uv=1)
clip = core.vinverse.vinverse2(clip, sstr=1.50, amnt=128)
# Dehalo using EdgeCleaner
clip = dehalo.EdgeCleaner(clip, strength=8)
# applying dehalo using DeHalo_alpha
clip = dehalo.DeHalo_alpha(clip, rx=1.00, ry=1.00, darkstr=0.40, brightstr=0.50, highsens=25, lowsens=25)
# removing grain using SMDegrain
clip = smdegrain.SMDegrain(clip, tr=6, thSAD=900, thSADC=500, RefineMotion=True, interlaced=False, pel=2, search=5, opencl=True, device=0)
# Fixing chroma bleeding using FixChromaBleedingMod
clip = chromaBleeding.FixChromaBleedingMod(clip, cx=3, cy=3, thr=1.00, strength=1.00)
[clip] = beforeResize(clip)
# clip current meta; color space: YUV420P16, bit depth: 16, resolution: 1280x960, fps: 23.976, color matrix: Rec.709, yuv luminance scale: limited, scanorder: progressive, full height: true
# adjusting color using Tweak
clip = color.Tweak(clip, hue=0.00, sat=1.00, cont=1.04, bright=-512, coring=False)
# sharpening using AWarpSharp2
clip = core.warp.AWarpSharp2(clip, blur=3, chroma=True)
# Using Hysteria for line darkening
clip = hysteria.Hysteria(clip, strength=3.00, lowthresh=2, highthresh=10, luma_cap=140)
# sharpening using LimitedSharpenFaster(Mod)
clip = sharpen.LSFmod(clip, strength=140, Szrp=1, SdmpHi=30, Lmode=3, edgemode=2, edgemaskHQ=True, preblur=1, cuda=True)
# debanding using GradFun3
clip = deband.GradFun3(clip, thr=0.40, mode=0, ampn=0.10, smode=5)
# adjusting output color from YUV420P16 to YUV420P10 for x265Model
clip = core.resize.Spline36(clip=clip, format=vs.YUV420P10)
# set output frame rate to 23.976fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# output
clip.set_output()
# script was created by Hybrid 2026.03.21.1
# defining beforeBiFrost-function - START
def beforeBiFrost(clip):
core.std.LoadPlugin(path=r"C:\Program Files\Hybrid\64bit\vsfilters\DeCrawlFilter\Tcomb\libtcomb.dll")
clip = core.tcomb.TComb(clip, mode=2, fthreshl=4, fthreshc=7, othreshl=5, othreshc=8)
return [clip]
# defining beforeBiFrost-function - END
# defining beforeResize-function - START
def beforeResize(clip):
# width 1280
# height 960
# colormatrix Rec.709
# colorformat YUV420P16
# 1. Manual 2x Upscale
clip = core.resize.Spline36(clip, width=640, height=480, format=vs.YUV420P16)
clip = core.nnedi3cl.NNEDI3CL(clip, field=0, dh=True, nsize=4, nns=4, qual=2)
clip = core.std.Transpose(clip)
clip = core.nnedi3cl.NNEDI3CL(clip, field=0, dh=True, nsize=4, nns=4, qual=2)
clip = core.std.Transpose(clip)
clip = core.resize.Spline36(clip, matrix_in_s="170m", matrix_s="709")
clip = core.std.SetFrameProps(clip, _Matrix=1, _Transfer=1, _Primaries=1, _SARNum=1, _SARDen=1)
# 2. Kill Rainbows (Grayscale)
grey = core.std.ShufflePlanes(clip, 0, 1)
grey = core.resize.Spline36(grey, format=vs.YUV420P16)
# 3. Load Plugin Manually
core.std.LoadPlugin(path=r"C:\Program Files\Hybrid\64bit\vsfilters\Support\RemapFramesVapoursynth.dll")
clip = core.remap.Rfs(clip, grey, mappings="[12255 21450]")
return [clip]
# defining beforeResize-function - END
# Import scripts
import edi_rpow2
import deband
import sharpen
import hysteria
import color
import chromaBleeding
import nnedi3_resample
import smdegrain
import dehalo
import deblock
import qtgmc
import validate
# Source: 'D:\Season 4 disk 2\A1_t00.mkv'
# Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: top field first, yuv luminance scale: limited, matrix: 170m, format: mpeg-2
# Loading 'D:\Season 4 disk 2\A1_t00.mkvÄ using LWLibavSource
clip = core.lsmas.LWLibavSource(source="D:/Season 4 disk 2/A1_t00.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# setting color matrix to 170m.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_ST170_M)
# setting color transfer (vs.TRANSFER_BT601), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
# setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
# 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: top field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
[clip] = beforeBiFrost(clip)
# clip current meta; color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 170m, yuv luminance scale: limited, scanorder: top field first, full height: true
# rainbow removal using BiFrost
clip = core.bifrost.Bifrost(clip, luma_thresh=4.00, variation=20, conservative_mask=True, interlaced=True)
clip2clip = clip
clip2clip = qtgmc.QTGMC(Input=clip2clip, Preset="fast", opencl=True, TFF=False, FPSDivisor=2)
# Deinterlacing using TIVTC
clip = core.tivtc.TFM(clip, clip2=clip2clip)
clip = core.tivtc.TDecimate(clip, mode=1) # new fps: 23.976
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
clip = core.std.Crop(clip, left=10, right=10, top=0, bottom=4) # cropping to 700x476
# applying deblocking using DeBlock QED
clip = deblock.Deblock_QED(clip, uv=1)
clip = core.vinverse.vinverse2(clip, sstr=1.50, amnt=128)
# Dehalo using EdgeCleaner
clip = dehalo.EdgeCleaner(clip, strength=8)
# applying dehalo using DeHalo_alpha
clip = dehalo.DeHalo_alpha(clip, rx=1.00, ry=1.00, darkstr=0.40, brightstr=0.50, highsens=25, lowsens=25)
# removing grain using SMDegrain
clip = smdegrain.SMDegrain(clip, tr=6, thSAD=900, thSADC=500, RefineMotion=True, interlaced=False, pel=2, search=5, opencl=True, device=0)
# Fixing chroma bleeding using FixChromaBleedingMod
clip = chromaBleeding.FixChromaBleedingMod(clip, cx=3, cy=3, thr=1.00, strength=1.00)
[clip] = beforeResize(clip)
# clip current meta; color space: YUV420P16, bit depth: 16, resolution: 1280x960, fps: 23.976, color matrix: Rec.709, yuv luminance scale: limited, scanorder: progressive, full height: true
# adjusting color using Tweak
clip = color.Tweak(clip, hue=0.00, sat=1.00, cont=1.04, bright=-512, coring=False)
# sharpening using AWarpSharp2
clip = core.warp.AWarpSharp2(clip, blur=3, chroma=True)
# Using Hysteria for line darkening
clip = hysteria.Hysteria(clip, strength=3.00, lowthresh=2, highthresh=10, luma_cap=140)
# sharpening using LimitedSharpenFaster(Mod)
clip = sharpen.LSFmod(clip, strength=140, Szrp=1, SdmpHi=30, Lmode=3, edgemode=2, edgemaskHQ=True, preblur=1, cuda=True)
# debanding using GradFun3
clip = deband.GradFun3(clip, thr=0.40, mode=0, ampn=0.10, smode=5)
# adjusting output color from YUV420P16 to YUV420P10 for x265Model
clip = core.resize.Spline36(clip=clip, format=vs.YUV420P10)
# set output frame rate to 23.976fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# output
clip.set_output()
# script was created by Hybrid 2026.03.21.1

