Guest User

Untitled

a guest
Jul 31st, 2026
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.16 KB | None | 0 0
  1. # Imports
  2. import ctypes
  3. import sys
  4. import os
  5. import vapoursynth as vs
  6. # using Vapoursynth R78
  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/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/cas.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/ReduceFlicker/ReduceFlicker.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/hysteresis/hysteresis.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/dfttest2/dfttest2_nvrtc.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/bwdif.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/nnedi3vk/nnedi3vk.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/eedi3vk2.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/addnoise.dll")
  28. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvutensils/mvutensils.dll")
  29. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.dll")
  30. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/zsmooth/zsmooth.dll")
  31. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/libbestsource.dll")
  32. # defining beforeYAHR-function - START
  33. def beforeYAHR(clip):
  34. clip = core.akarin.Expr(clip, expr=["x 200 > x 0.8 * 40 + x ?","", ""]) # Luma only
  35. return [clip]
  36. # defining beforeYAHR-function - END
  37.  
  38. # defining beforeBlindDeHalo3-function - START
  39. def beforeBlindDeHalo3(clip):
  40. clip = dehalo.SecondOrderDehalo(clip)
  41. return [clip]
  42. # defining beforeBlindDeHalo3-function - END
  43.  
  44. # Import scripts
  45. import sharpen
  46. import dehalo
  47. import edge
  48. import SpotLess
  49. import dfttest2
  50. import qtgmc
  51. import validate
  52. # Source: 'C:\Users\Selur\Desktop\Show_Clips_(7-9-2026)_sample.mov'
  53. # clip current meta; color space: YUV422P10, bit depth: 10, resolution: 720x486, fps: 29.97, color matrix: 170m, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: bottom field first, full height: true (Source)
  54. # Loading 'C:\Users\Selur\Desktop\Show_Clips_(7-9-2026)_sample.mov' using BestSource
  55. clip = core.bs.VideoSource(source="C:/Users/Selur/Desktop/Show_Clips_(7-9-2026)_sample.mov", cachepath="J:/tmp/Show_Clips_(7-9-2026)_sample_bestSource", track=0, hwdevice="opencl")
  56. frame = clip.get_frame(0)
  57. # setting color matrix to 170m.
  58. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_ST170_M)
  59. # setting color transfer (vs.TRANSFER_BT709), if it is not set.
  60. if validate.transferIsInvalid(clip):
  61. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
  62. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  63. if validate.primariesIsInvalid(clip):
  64. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  65. # setting color range to TV (limited) range.
  66. prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
  67. clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})
  68. # making sure frame rate is set to 29.97fps
  69. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  70. # making sure the detected scan type is set (detected: bottom field first)
  71. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_BOTTOM) # scan type: bottom field first
  72. # Deinterlacing using QTGMC
  73. clip = qtgmc.QTGMC(clip, Preset="Fast", TFF=False, opencl=True) # new fps: 59.94
  74. # Making sure content is perceived as frame based
  75. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  76. # Spot removal using SpotLess + DeltaRestore
  77. clip = SpotLess.SpotDelta(clip, radT=3, rec=True, pel=1, dark2_brt=0.97, sharpen_it=False)
  78. # removing flickering using ReduceFlicker
  79. clip = core.rdfl.ReduceFlicker(clip, strength=3, aggressive=1)
  80. clip = core.std.Crop(clip, left=56, right=40, top=4, bottom=12) # cropping to 624x470
  81. # Fix bright and dark line artifacts near the border of an image using BalanceBorders
  82. clip = edge.bbmod(clip, cLeft=12, cTop=0, cRight=0, cBottom=0)
  83. # contrast sharpening using CAS
  84. clip = core.cas.CAS(clip, sharpness=0.700)
  85. # applying dehalo using DeHalo_alpha
  86. clip = dehalo.DeHalo_alpha(clip)
  87. [clip] = beforeYAHR(clip)
  88. # clip current meta; color space: YUV422P10, bit depth: 10, resolution: 624x470, fps: 59.94, color matrix: 170m, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true
  89. # applying dehalo using YAHR
  90. for i in range(0,5):
  91. clip = dehalo.YAHR(clip, depth=16)
  92. [clip] = beforeBlindDeHalo3(clip)
  93. # clip current meta; color space: YUV422P10, bit depth: 10, resolution: 624x470, fps: 59.94, color matrix: 170m, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true
  94. # adjusting output color from YUV422P10 to YUV420P10 for NVEncModel
  95. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10)
  96. # set output frame rate to 59.94fps (progressive)
  97. clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
  98. # output
  99. clip.set_output()
  100. # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 624x470, fps: 59.94, color matrix: 170m, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
  101. # script was created by Hybrid 2026.07.31.1
Advertisement
Add Comment
Please, Sign In to add comment