Guest User

Untitled

a guest
Apr 27th, 2026
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.77 KB | None | 0 0
  1. # Imports
  2. import logging
  3. import ctypes
  4. import sys
  5. import os
  6. import vapoursynth as vs
  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. # Force logging to std:err
  17. logging.StreamHandler(sys.stderr)
  18. # loading plugins
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libdescale.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/KNLMeansCL/vsnlm_cuda.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/vszip.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvtools.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/vsfilters/Support/libeedi3vk.dll")
  31. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.dll")
  32. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/zsmooth/zsmooth.dll")
  33. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DerainbowFilter/DeCross/libdecross.dll")
  34. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
  35. # Import scripts
  36. import proToon
  37. import deband
  38. import qtgmc
  39. import validate
  40. # Source: 'C:\Users\Selur\Desktop\A1_t00.mkv'
  41. # Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: telecine, yuv luminance scale: limited, matrix: 470bg, format: mpeg-2
  42. # Loading 'C:\Users\Selur\Desktop\A1_t00.mkv' using DGSource
  43. clip = core.dgdecodenv.DGSource("J:/tmp/mkv_4b00747d725da0f5f7d7cfd0d25e8c45_853323747.dgi",fieldop=0) # 29.97 fps, scanorder: telecine
  44. frame = clip.get_frame(0)
  45. # setting color matrix to 470bg.
  46. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
  47. # setting color transfer (vs.TRANSFER_BT601), if it is not set.
  48. if validate.transferIsInvalid(clip):
  49. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
  50. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  51. if validate.primariesIsInvalid(clip):
  52. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  53. # setting color range to TV (limited) range.
  54. prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
  55. clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})
  56. # making sure frame rate is set to 29.97fps
  57. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  58. # making sure the detected scan type is set (detected: telecine)
  59. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
  60. # rainbow removal using DeCross
  61. clip = core.decross.DeCross(clip)
  62. clip2clip = clip
  63. clip2clip = qtgmc.QTGMC(Input=clip2clip, Preset="fast", opencl=True, 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 preceived as frame based
  68. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  69. clip = core.vszip.Checkmate(clip)
  70. clip = core.std.Crop(clip, left=2, right=12, top=0, bottom=0) # cropping to 706x480
  71. # adjusting color space from YUV420P8 to RGB24 for vsKNLMeansCL
  72. clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_in_s="limited", range_s="full")
  73. # denoising using KNLMeansCL
  74. clip = core.nlm_cuda.NLMeans(clip, h=5.00)
  75. # adjusting color space from RGB24 to YUV444P16 for vsGradFun3Mod
  76. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_in_s="full", range_s="limited") # additional resize to match target color sampling
  77. # debanding using GradFun3
  78. clip = deband.GradFun3(clip, thr=1.50, radius=15)
  79. # line darkening using proToon
  80. clip = proToon.proToon(clip, strength=64, pcScale=False)
  81. from vsrealesrgan import realesrgan as RealESRGAN
  82. clip = core.std.AddBorders(clip=clip, left=0, right=2, top=0, bottom=0) # add borders to archive mod 4 (vsRealESRGAN) - 708x480
  83. # adjusting color space from YUV444P16 to RGBS for vsRealESRGAN
  84. clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_in_s="limited", range_s="full")
  85. # resizing using RealESRGAN
  86. clip = RealESRGAN(clip, model=204, device_index=0) # 1416x960
  87. clip = core.std.Crop(clip=clip, left=0, right=4, top=0, bottom=0) # removing added borders from mod requirement (vsRealESRGAN) - 1412x960
  88. # resizing 1412x960 to 1280x980
  89. clip = core.fmtc.resample(clip, w=1280, h=980, kernel="spline64", interlaced=False, interlacedd=False)
  90. # adjusting output color from RGBS to YUV420P10 for NVEncModel
  91. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_in_s="full", range_s="limited", dither_type="error_diffusion") # additional resize to match target color sampling
  92. # set output frame rate to 23.976fps (progressive)
  93. clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
  94. # output
  95. clip.set_output()
  96. # script was created by Hybrid 2026.04.26.1
Advertisement
Add Comment
Please, Sign In to add comment