Guest User

Untitled

a guest
Oct 2nd, 2026
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.58 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. # Import scripts folder
  10. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  11. sys.path.insert(0, os.path.abspath(scriptPath))
  12. # Loading Support Files
  13. Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  14. # loading plugins
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/znedi3.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/zsmooth/zsmooth.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvutensils/mvutensils.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/vszip/vszip.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.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/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/composite.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
  25. # Import scripts
  26. import dehalo
  27. import qtgmc
  28. import nnedi3_resample
  29. import smdegrain
  30. import SpotLess
  31. import color
  32. import validate
  33. # Source: 'C:\Users\Selur\Desktop\Communion- Side One unprocessed sample.avi'
  34. # clip current meta; color space: YUV422P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: field-shifted, full height: true (Source)
  35. # Loading 'C:\Users\Selur\Desktop\Communion- Side One unprocessed sample.avi' using LWLibavSource
  36. clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/Communion- Side One unprocessed sample.avi", format="YUV422P8", stream_index=0, cache=0, prefer_hw=0)
  37. frame = clip.get_frame(0)
  38. # setting color matrix to 470bg.
  39. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
  40. # setting color transfer (vs.TRANSFER_BT601), if it is not set.
  41. if validate.transferIsInvalid(clip):
  42. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
  43. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  44. if validate.primariesIsInvalid(clip):
  45. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  46. # setting color range to TV (limited) range.
  47. prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
  48. clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})
  49. # making sure frame rate is set to 29.97fps
  50. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  51. # making sure the detected scan type is set (detected: field-shifted)
  52. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
  53. # restoration using Composite
  54. clip = core.composite.Restore(clip, standard="ntsc")
  55.  
  56. # Field matching using TFM
  57. clip = core.tivtc.TFM(clip)
  58. # Making sure content is perceived as frame based
  59. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  60. # adjusting dynamic luma range usingAutoGain
  61. clip = color.AutoGain(clip, tools={'expr': 'akarin', 'planestats': 'vszip', 'scd': 'std'})
  62. # Spot removal using SpotLess
  63. clip = SpotLess.SpotLess(clip, radT=2, asearch=4, pel=1, mStart=True, mEnd=True, tools={'mv': 'mvutensils', 'expr': 'akarin', 'tmedian': 'zsmooth', 'ttempsmooth': 'zsmooth', 'boxblur': 'std', 'hysteresis': 'hysteresis'})
  64. clip = core.std.Crop(clip, left=0, right=12, top=102, bottom=108) # cropping to 708x270
  65. # removing grain using SMDegrain
  66. clip = smdegrain.SMDegrain(clip, tr=3, thSAD=600, thSADC=356, RefineMotion=False, contrasharp=50, interlaced=False, tools={'mv': 'mvutensils', 'expr': 'akarin', 'nnedi3': 'znedi3', 'dfttest': 'dfttest', 'nlmeans': 'nlm_ispc', 'bm3d': 'bm3d', 'rg': 'zsmooth', 'median': 'zsmooth', 'boxblur': 'std', 'scd': 'std'})
  67. clip = core.std.AddBorders(clip=clip, left=0, right=0, top=0, bottom=2) # add borders to archive mod 4 (vsQTGMCFilter) - 708x272
  68. # Denoising using QTGMC
  69. clip = qtgmc.QTGMC(clip, Preset="Fast", InputType=2, TR2=1, TFF=False, SourceMatch=0, Lossless=0, tools={'mv': 'mvutensils', 'expr': 'akarin', 'nnedi3': 'znedi3', 'eedi3': 'vszip', 'dfttest': 'dfttest', 'nlmeans': 'nlm_ispc', 'bm3d': 'bm3d', 'rg': 'zsmooth', 'median': 'zsmooth', 'fft3d': 'neo_fft3d', 'grain': 'noise'})
  70. clip = core.std.Crop(clip=clip, left=0, right=0, top=0, bottom=2) # removing added borders from mod requirement (vsQTGMCFilter) - 708x270
  71. # applying dehalo using YAHR
  72. for i in range(0,3):
  73. clip = dehalo.YAHR(clip, depth=24, tools={'expr': 'akarin', 'warp': 'warp', 'rg': 'zsmooth', 'median': 'zsmooth'})
  74. # adjusting output color from YUV444P16 to YUV420P10 for NVEncModel
  75. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, dither_type="error_diffusion")
  76. # set output frame rate to 29.97fps (progressive)
  77. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  78. # output
  79. clip.set_output()
  80. # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 708x270, fps: 29.97, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
  81. # script was created by Hybrid 2026.10.02.1
Advertisement
Add Comment
Please, Sign In to add comment