ENunn
3rd November 2025, 02:13
i'm just now learning how to use vs. i want to translate my vhs processing script that was made in avisynth to vapoursynth. i got most of it down, but there's some that's missing.
my avisynth script:
LoadVirtualDubPlugin("C:\Program Files (x86)\AviSynth+\plugins64+\ccd_64bit.vdf", "ccd", 0)
v = AVISource("J:\virtualdub\tape transfers\opening to two to tango 1989 vhs.avi")
a = lwlibavaudioSource("D:\recordings\opening to two to tango 1989 vhs.flac")
audiodub(v,a)
#delayaudio(1.026)
assumetff().converttoyuv422(matrix="rec601", interlaced=true).convertbits(10)
Levels(60, 1,895, 0, 1020, coring=false,dither=true).tweak(bright=0, cont=1.00, hue=-0, sat=0.850, coring=false, dither=true).convertbits(8)
#turnRight().Histogram().TurnLeft()
Trim(801, 6484)
Mergechroma(separatefields().vinverse().weave())
converttorgb32(matrix="rec601", interlaced=true,chromaresample="point")
e=separatefields().selecteven().CCD(5,0)
o=separatefields().selectodd().CCD(5,0)
interleave(e,o).weave()
converttoyv24(matrix="rec601", interlaced=true,chromaresample="point")
e2=separatefields().selecteven(). ChromaShiftSP(x=0.0,y=0.15)
o2=separatefields().selectodd(). ChromaShiftSP(x=0.0,y=0.15)
interleave(e2,o2).weave()
QTGMC(TR0=2, TR1=2, TR2=2, Rep0=1, Rep1=0, Rep2=4,
\ DCT=5, ThSCD1=300, ThSCD2=110,
\ SourceMatch=3, Lossless=2, Sharpness=0.0, SLMode=0, Sbb=0, MatchPreset="slow",
\ ezdenoise=0.0, ezkeepgrain=1.0, NoiseProcess=2, GrainRestore=0.3, NoiseRestore=0.1, NoisePreset="slow",
\ StabilizeNoise=false, NoiseTR=0, NoiseDeint="generate")
MergeChroma(aWarpSharp2(depth=20))MergeChroma(aWarpSharp2(depth=10))
santiag(strh=3, strv=3, nns=4, nsize=5)
neo_dfttest(sigma=5, tbsize=3, dither=2)
LSFplus(ss_x=1.5, ss_y=1.5, secure=true, Spwr=2, SdmpHi=0, soothe=false, preblur="on", keep=25)
FineDehalo(rx=2.5, ry=2.5)
resizeshader(width=652, kernel="ssim")
#selectodd()
Crop(11, 0, -11, -8)
SuperRes(matrixin="rec601", 2, .43, 0, """nnedi3_rpow2(4, nns=4, cshift="Spline16Resize")""", matrixout="rec709")
#SuperRes(2, .43, 0, """edi_rpow2(2, nns=4, cshift="Spline16Resize")""").SuperRes(2, .43, 0, """edi_rpow2(2, nns=4, cshift="Spline16Resize")""")
x = float(width) / float(height)
resizeshader(width=round(x * 2176),height=2176, kernel="ssim")
converttoyv12(matrix="rec709", interlaced=false,chromaresample="point")
prefetch(6)
my vapoursynth script so far:
import vapoursynth as vs
from functools import partial
from vsdenoise import DFTTest
from vsaa import BWDIF, EEDI3, EEDI2, NNEDI3
import havsfunc as havs
import ctypes
import sys
import os
import adjust
import edi_rpow2
core = vs.core
core.num_threads = 12
from vapoursynth import core
from vsdeinterlace import QTempGaussMC
clip = core.bs.VideoSource(source=rf"J:\virtualdub\tape transfers\opening to two to tango 1989 vhs.avi", fpsnum=30000, fpsden=1001)
audio = core.bs.AudioSource(source=rf"D:\recordings\opening to two to tango 1989 vhs.flac", )
clip = core.fmtc.bitdepth (clip,bits=10)
#clip = core.std.Levels(clip, min_in=64, max_in=940, min_out=0, max_out=1120, planes=0)
clip = core.std.Levels(clip, min_in=68, max_in=940, min_out=0, max_out=1105, planes=0)
clip = adjust.Tweak(clip, sat=0.85)
clip = core.resize.Point(clip, format=vs.YUV444P8)
#clip = core.hist.Classic(clip)
clip = core.std.Trim(clip, first=802, last=6481)
#audio = core.std.AudioTrim(audio, first=802, last=6481)
clip = havs.QTGMC(clip, TR0=2, TR1=2, Rep0=1, Rep1=0, Rep2=4, DCT=5, ThSCD1=300, ThSCD2=110, SourceMatch=3, Lossless=2, Sharpness=0.0, SLMode=0, Sbb=0, MatchPreset="Slow", EZDenoise=0.0, EZKeepGrain=1.0, NoiseProcess=2, GrainRestore=0.3, NoiseRestore=0.1, NoisePreset="Slow", StabilizeNoise=False, NoiseTR=0, NoiseDeint="Generate", TFF=True)
awarpsharp1 = core.warp.AWarpSharp2(clip, depth=20)
awarpsharp2 = core.warp.AWarpSharp2(clip, depth=10)
clip= core.std.ShufflePlanes(clips=[awarpsharp1,awarpsharp1], planes=[0, 1, 2], colorfamily=vs.YUV)
clip= core.std.ShufflePlanes(clips=[awarpsharp2,awarpsharp2], planes=[0, 1, 2], colorfamily=vs.YUV)
clip = havs.santiag(clip, strh=3, strv=3, nns=4, nsize=5)
clip = core.neo_dfttest.DFTTest(clip,sigma=5, tbsize=3, dither=2)
clip = havs.LSFmod(clip, ss_x=1.5, ss_y=1.5, secure=True, Spwr=2, SdmpHi=0, soothe=False, keep=5)
clip = fine_dehalo(clip)
#clip = core.resize.Bicubic(clip, width=652)
clip.set_output(0)
audio.set_output(1)
what i want to translate:
LoadVirtualDubPlugin("C:\Program Files (x86)\AviSynth+\plugins64+\ccd_64bit.vdf", "ccd", 0)
Levels(50, 1,860, 0, 1020, coring=false,dither=true).tweak(bright=0, cont=1.00, hue=-0, sat=0.850, coring=false, dither=true).convertbits(8)
e=separatefields().selecteven().CCD(5,0)
o=separatefields().selectodd().CCD(5,0)
interleave(e,o).weave()
SuperRes(matrixin="rec601", 2, .43, 0, """nnedi3_rpow2(4, nns=4, cshift="Spline16Resize")""", matrixout="rec709")
x = float(width) / float(height)
resizeshader(width=round(x * 2176),height=2176, kernel="ssim")
i do notice that it seems like nothing is really happening after qtgmc. warping, but that's it. not exactly like my avisynth script.
and i probably need some help learning how to trim both audio and video at the same time. is there an easy way to do all this translating and such? anything extra that i need?
my avisynth script:
LoadVirtualDubPlugin("C:\Program Files (x86)\AviSynth+\plugins64+\ccd_64bit.vdf", "ccd", 0)
v = AVISource("J:\virtualdub\tape transfers\opening to two to tango 1989 vhs.avi")
a = lwlibavaudioSource("D:\recordings\opening to two to tango 1989 vhs.flac")
audiodub(v,a)
#delayaudio(1.026)
assumetff().converttoyuv422(matrix="rec601", interlaced=true).convertbits(10)
Levels(60, 1,895, 0, 1020, coring=false,dither=true).tweak(bright=0, cont=1.00, hue=-0, sat=0.850, coring=false, dither=true).convertbits(8)
#turnRight().Histogram().TurnLeft()
Trim(801, 6484)
Mergechroma(separatefields().vinverse().weave())
converttorgb32(matrix="rec601", interlaced=true,chromaresample="point")
e=separatefields().selecteven().CCD(5,0)
o=separatefields().selectodd().CCD(5,0)
interleave(e,o).weave()
converttoyv24(matrix="rec601", interlaced=true,chromaresample="point")
e2=separatefields().selecteven(). ChromaShiftSP(x=0.0,y=0.15)
o2=separatefields().selectodd(). ChromaShiftSP(x=0.0,y=0.15)
interleave(e2,o2).weave()
QTGMC(TR0=2, TR1=2, TR2=2, Rep0=1, Rep1=0, Rep2=4,
\ DCT=5, ThSCD1=300, ThSCD2=110,
\ SourceMatch=3, Lossless=2, Sharpness=0.0, SLMode=0, Sbb=0, MatchPreset="slow",
\ ezdenoise=0.0, ezkeepgrain=1.0, NoiseProcess=2, GrainRestore=0.3, NoiseRestore=0.1, NoisePreset="slow",
\ StabilizeNoise=false, NoiseTR=0, NoiseDeint="generate")
MergeChroma(aWarpSharp2(depth=20))MergeChroma(aWarpSharp2(depth=10))
santiag(strh=3, strv=3, nns=4, nsize=5)
neo_dfttest(sigma=5, tbsize=3, dither=2)
LSFplus(ss_x=1.5, ss_y=1.5, secure=true, Spwr=2, SdmpHi=0, soothe=false, preblur="on", keep=25)
FineDehalo(rx=2.5, ry=2.5)
resizeshader(width=652, kernel="ssim")
#selectodd()
Crop(11, 0, -11, -8)
SuperRes(matrixin="rec601", 2, .43, 0, """nnedi3_rpow2(4, nns=4, cshift="Spline16Resize")""", matrixout="rec709")
#SuperRes(2, .43, 0, """edi_rpow2(2, nns=4, cshift="Spline16Resize")""").SuperRes(2, .43, 0, """edi_rpow2(2, nns=4, cshift="Spline16Resize")""")
x = float(width) / float(height)
resizeshader(width=round(x * 2176),height=2176, kernel="ssim")
converttoyv12(matrix="rec709", interlaced=false,chromaresample="point")
prefetch(6)
my vapoursynth script so far:
import vapoursynth as vs
from functools import partial
from vsdenoise import DFTTest
from vsaa import BWDIF, EEDI3, EEDI2, NNEDI3
import havsfunc as havs
import ctypes
import sys
import os
import adjust
import edi_rpow2
core = vs.core
core.num_threads = 12
from vapoursynth import core
from vsdeinterlace import QTempGaussMC
clip = core.bs.VideoSource(source=rf"J:\virtualdub\tape transfers\opening to two to tango 1989 vhs.avi", fpsnum=30000, fpsden=1001)
audio = core.bs.AudioSource(source=rf"D:\recordings\opening to two to tango 1989 vhs.flac", )
clip = core.fmtc.bitdepth (clip,bits=10)
#clip = core.std.Levels(clip, min_in=64, max_in=940, min_out=0, max_out=1120, planes=0)
clip = core.std.Levels(clip, min_in=68, max_in=940, min_out=0, max_out=1105, planes=0)
clip = adjust.Tweak(clip, sat=0.85)
clip = core.resize.Point(clip, format=vs.YUV444P8)
#clip = core.hist.Classic(clip)
clip = core.std.Trim(clip, first=802, last=6481)
#audio = core.std.AudioTrim(audio, first=802, last=6481)
clip = havs.QTGMC(clip, TR0=2, TR1=2, Rep0=1, Rep1=0, Rep2=4, DCT=5, ThSCD1=300, ThSCD2=110, SourceMatch=3, Lossless=2, Sharpness=0.0, SLMode=0, Sbb=0, MatchPreset="Slow", EZDenoise=0.0, EZKeepGrain=1.0, NoiseProcess=2, GrainRestore=0.3, NoiseRestore=0.1, NoisePreset="Slow", StabilizeNoise=False, NoiseTR=0, NoiseDeint="Generate", TFF=True)
awarpsharp1 = core.warp.AWarpSharp2(clip, depth=20)
awarpsharp2 = core.warp.AWarpSharp2(clip, depth=10)
clip= core.std.ShufflePlanes(clips=[awarpsharp1,awarpsharp1], planes=[0, 1, 2], colorfamily=vs.YUV)
clip= core.std.ShufflePlanes(clips=[awarpsharp2,awarpsharp2], planes=[0, 1, 2], colorfamily=vs.YUV)
clip = havs.santiag(clip, strh=3, strv=3, nns=4, nsize=5)
clip = core.neo_dfttest.DFTTest(clip,sigma=5, tbsize=3, dither=2)
clip = havs.LSFmod(clip, ss_x=1.5, ss_y=1.5, secure=True, Spwr=2, SdmpHi=0, soothe=False, keep=5)
clip = fine_dehalo(clip)
#clip = core.resize.Bicubic(clip, width=652)
clip.set_output(0)
audio.set_output(1)
what i want to translate:
LoadVirtualDubPlugin("C:\Program Files (x86)\AviSynth+\plugins64+\ccd_64bit.vdf", "ccd", 0)
Levels(50, 1,860, 0, 1020, coring=false,dither=true).tweak(bright=0, cont=1.00, hue=-0, sat=0.850, coring=false, dither=true).convertbits(8)
e=separatefields().selecteven().CCD(5,0)
o=separatefields().selectodd().CCD(5,0)
interleave(e,o).weave()
SuperRes(matrixin="rec601", 2, .43, 0, """nnedi3_rpow2(4, nns=4, cshift="Spline16Resize")""", matrixout="rec709")
x = float(width) / float(height)
resizeshader(width=round(x * 2176),height=2176, kernel="ssim")
i do notice that it seems like nothing is really happening after qtgmc. warping, but that's it. not exactly like my avisynth script.
and i probably need some help learning how to trim both audio and video at the same time. is there an easy way to do all this translating and such? anything extra that i need?