Guest User

Untitled

a guest
Aug 21st, 2026
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.44 KB | None | 0 0
  1. # Imports
  2. import ctypes
  3. import sys
  4. import os
  5. import vapoursynth as vs
  6. # using Vapoursynth R79
  7. # getting Vapoursynth core
  8. core = vs.core
  9. # Limit frame cache to 48449MB
  10. core.max_cache_size = 48449
  11. # Import scripts folder
  12. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  13. sys.path.insert(0, os.path.abspath(scriptPath))
  14. # Loading Support Files
  15. Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  16. # loading plugins
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/sangnom.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI2CUDA.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/scenechange.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/bifrost.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/tivtc.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/addnoise.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/znedi3.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/sneedif/libsneedif.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvutensils/mvutensils.dll")
  28. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
  29. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  30. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/eedi3m.dll")
  31. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/vszip/vszip.dll")
  32. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.dll")
  33. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/zsmooth/zsmooth.dll")
  34. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
  35. # Import scripts
  36. import antiAliasing
  37. import derainbow
  38. import sharpen
  39. import linedarken
  40. import qtgmc
  41. import validate
  42. # Source: 'C:\Users\Selur\Desktop\removeheavyanalogartifacts.ts'
  43. # clip current meta; color space: YUV420P8, bit depth: 8, resolution: 1440x1080, fps: 29.97, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: telecine, full height: true (Source)
  44. # Loading 'C:\Users\Selur\Desktop\removeheavyanalogartifacts.ts' using DGSource
  45. clip = core.dgdecodenv.DGSource("J:/tmp/ts_541bdebe8c57c01d2fbdb83685d70881_853323747.dgi",fieldop=0) # 29.97 fps, scanorder: telecine
  46. frame = clip.get_frame(0)
  47. # setting color matrix to 709.
  48. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
  49. # setting color transfer (vs.TRANSFER_BT709), if it is not set.
  50. if validate.transferIsInvalid(clip):
  51. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
  52. # setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
  53. if validate.primariesIsInvalid(clip):
  54. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
  55. # setting color range to TV (limited) range.
  56. prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
  57. clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})
  58. # making sure frame rate is set to 29.97fps
  59. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  60. # making sure the detected scan type is set (detected: telecine)
  61. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
  62. clip2clip = clip
  63. clip2clip = qtgmc.QTGMC(Input=clip2clip, Preset="fast", TFF=False, FPSDivisor=2)
  64. # Deinterlacing using TIVTC
  65. clip = core.tivtc.TFM(clip, clip2=clip2clip)
  66. clip = core.tivtc.TDecimate(clip) # new fps: 23.976
  67. # Making sure content is perceived as frame based
  68. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  69. # line darkening using Toon
  70. clip = linedarken.Toon(clip)
  71. clip = core.fmtc.resample(clip=clip, w=960, h=540, kernel="point", interlaced=False, interlacedd=False) # resizing for 'Gimmick' (vsQTGMCFilter)
  72. # Denoising using QTGMC
  73. clip = qtgmc.QTGMC(clip, Preset="Fast", InputType=3, TR2=1, TFF=False, SourceMatch=0, Lossless=0, opencl=True)
  74. # rainbow removal using ChubbyRain2
  75. clip = derainbow.ChubbyRain2(clip, interlaced=False)
  76. clipMerge = clip
  77. clip = core.std.AddBorders(clip=clip, left=0, right=0, top=2, bottom=2) # add borders to archive mod 8 (vsBasicVSRPPFilter) - 960x544
  78. # adjusting color space from YUV420P16 to RGBH for vsBasicVSRPPFilter
  79. clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="709", range_in_s="limited", range_s="full")
  80. # Quality enhancement using BasicVSR++
  81. from vsbasicvsrpp import basicvsrpp as BasicVSRPP
  82. clip = BasicVSRPP(clip, model=4)
  83. clip = core.std.Crop(clip=clip, left=0, right=0, top=2, bottom=2) # removing added borders from mod requirement (vsBasicVSRPPFilter) - 960x540
  84. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P16, matrix_s="709", range_in_s="full", range_s="limited")
  85. clip = core.std.Merge(clipMerge,clip,[0, 1, 1]) # merge filtered and unfiltered by plane
  86. # applying anti aliasing using santiag
  87. clip = antiAliasing.santiag(clip, nns=2, qual=2, pscrn=2, exp=1, opencl=True)
  88. # Resizing using 10 - bicubic spline
  89. clip = core.fmtc.resample(clip, kernel="spline16", w=1920, h=1440, interlaced=False, interlacedd=False) # resolution 1920x1440 before YUV420P16 after YUV420P16
  90. # applying AA using SangNom
  91. clip = core.sangnom.SangNom(clip, aa=[48,0])
  92. # adjusting output color from YUV420P16 to YUV420P10 for NVEncModel
  93. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, dither_type="error_diffusion")
  94. # set output frame rate to 23.976fps (progressive)
  95. clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
  96. # output
  97. clip.set_output()
  98. # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 1920x1440, fps: 23.976, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
  99. # script was created by Hybrid 2026.08.20.1
Advertisement
Add Comment
Please, Sign In to add comment