Guest User

Untitled

a guest
Mar 4th, 2026
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.71 KB | None | 0 0
  1. # Imports
  2. import vapoursynth as vs
  3. # getting Vapoursynth core
  4. import logging
  5. import ctypes
  6. import sys
  7. import os
  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/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  28. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/RemoveDirt/libremovedirtvs.dll")
  29. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll")
  30. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  31. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/akarin.dll")
  32. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/BestSource/BestSource.dll")
  33. # defining beforeDeCross-function - START
  34. def beforeDeCross(clip):
  35. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/vcm.dll")
  36. clip = core.vcm.DeJitter(clip, jmax=10, thresh=0.03, wsyn=4)
  37. return [clip]
  38. # defining beforeDeCross-function - END
  39.  
  40. # Import scripts
  41. import linedarken
  42. import qtgmc
  43. import nnedi3_resample
  44. import smdegrain
  45. import killerspots
  46. import SpotLess
  47. import validate
  48. # Source: 'G:\clips\drop outs - comets\test_20000.mov'
  49. # Current color space: YUV444P12, bit depth: 12, resolution: 760x488, frame rate: 29.97fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, format: prores
  50. # Loading 'G:\clips\drop outs - comets\test_20000.mov' using BestSource
  51. clip = core.bs.VideoSource(source="G:/clips/drop outs - comets/test_20000.mov", cachepath="J:/tmp/test_20000_bestSource", track=0, hwdevice="opencl")
  52. frame = clip.get_frame(0)
  53. # setting color matrix to 709.
  54. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
  55. # setting color transfer (vs.TRANSFER_BT601), if it is not set.
  56. if validate.transferIsInvalid(clip):
  57. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
  58. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  59. if validate.primariesIsInvalid(clip):
  60. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  61. # setting color range to TV (limited) range.
  62. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
  63. # making sure frame rate is set to 29.97fps
  64. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  65. # making sure the detected scan type is set (detected: progressive)
  66. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  67. [clip] = beforeDeCross(clip)
  68. # clip current meta; color space: YUV444P12, bit depth: 12, resolution: 760x488, fps: 29.97, color matrix: 709, yuv luminance scale: limited, scanorder: progressive, full height: true
  69. # Spot removal using SpotLess
  70. clip = SpotLess.SpotLess(clip, rec=True, pel=1, smoother="zsmooth")
  71. # adjusting color space from YUV444P12 to YUV420P8 for vsKillerSpots
  72. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, dither_type="error_diffusion")
  73. # spot/dirt removal using KillerSpots
  74. clip = killerspots.KillerSpots(clip, advanced=False)
  75. clip = core.std.Crop(clip, left=8, right=14, top=4, bottom=4) # cropping to 738x480
  76. # removing grain using SMDegrain
  77. clip = smdegrain.SMDegrain(clip, tr=3, thSAD=1200, contrasharp=50, interlaced=False, opencl=True, device=-1)
  78. clip = core.std.AddBorders(clip=clip, left=0, right=2, top=0, bottom=0) # add borders to archive mod 4 (vsQTGMCFilter) - 740x480
  79. # Denoising using QTGMC
  80. clip = qtgmc.QTGMC(clip, Preset="Fast", InputType=3, TR2=1, TFF=False, SourceMatch=0, Lossless=0, opencl=True)
  81. clip = core.std.Crop(clip=clip, left=0, right=2, top=0, bottom=0) # removing added borders from mod requirement (vsQTGMCFilter) - 738x480
  82. # line darkening using Toon
  83. clip = linedarken.Toon(clip, str=1.50)
  84. # adjusting resolution before resizing
  85. clip = core.fmtc.resample(clip, w=368, h=480, kernel="cubic", interlaced=False, interlacedd=False) # before YUV420P8 after YUV420P16
  86. from vsrealesrgan import realesrgan as RealESRGAN
  87. # adjusting color space from YUV420P16 to RGBS for vsRealESRGAN
  88. clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="709", range_in_s="limited", range_s="full", dither_type="error_diffusion")
  89. # resizing using RealESRGAN
  90. clip = RealESRGAN(clip, model=102, device_index=0) # 736x960
  91. # resizing 736x960 to 1280x710
  92. clip = core.fmtc.resample(clip, w=1280, h=710, kernel="spline64", interlaced=False, interlacedd=False)
  93. # adjusting output color from RGBS to YUV420P10 for NVEncModel
  94. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_in_s="full", range_s="limited") # additional resize to match target color sampling
  95. # set output frame rate to 29.97fps (progressive)
  96. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  97. # output
  98. clip.set_output()
  99. # script was created by Hybrid 2026.03.04.1
Advertisement
Add Comment
Please, Sign In to add comment