Guest User

Untitled

a guest
Sep 14th, 2026
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.13 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/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/znedi3.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/sneedif/libsneedif.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/eedi3m.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/vszip/vszip.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/addnoise.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvutensils/mvutensils.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/zsmooth/zsmooth.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/tivtc.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
  28. # defining beforeGrayworld-function - START
  29. def beforeGrayworld(clip):
  30. def set_interp_flag(n, f):
  31. f = f.copy()
  32. mics = f.props.get("TFMMics")
  33. use = (mics is not None and len(mics) >= 3
  34. and (mics[0] == 256 or mics[1] == 256))
  35. f.props._UseInterp = 1 if use else 0
  36. return f
  37. flagged = core.std.ModifyFrame(clip, clip, set_interp_flag)
  38. clip = flagged
  39. MAX_RUN = 8 # bigger than the longest run you actually expect
  40. for _ in range(MAX_RUN):
  41. prev = core.std.BlankClip(clip, length=1) + \
  42. core.std.Trim(clip, 0, clip.num_frames - 2)
  43. clip = core.akarin.Select([clip, prev], flagged, "x._UseInterp 1 0 ?")
  44. return [clip]
  45. # defining beforeGrayworld-function - END
  46.  
  47. # Import scripts
  48. import qtgmc
  49. import validate
  50. # Source: 'C:\Users\Selur\Desktop\segment3.avi'
  51. # clip current meta; color space: YUV422P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: field-shifted, full height: true (Source)
  52. # Loading 'C:\Users\Selur\Desktop\segment3.avi' using LWLibavSource
  53. clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/segment3.avi", format="YUV422P8", stream_index=0, cache=0, prefer_hw=0)
  54. frame = clip.get_frame(0)
  55. # setting color matrix to 470bg.
  56. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
  57. # setting color transfer (vs.TRANSFER_BT601), if it is not set.
  58. if validate.transferIsInvalid(clip):
  59. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
  60. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  61. if validate.primariesIsInvalid(clip):
  62. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  63. # setting color range to TV (limited) range.
  64. prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
  65. clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})
  66. # making sure frame rate is set to 25fps
  67. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  68. # making sure the detected scan type is set (detected: field-shifted)
  69. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
  70.  
  71. # Field matching using TFM
  72. clip = core.tivtc.TFM(clip, mChroma=False)
  73. # Making sure content is perceived as frame based
  74. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  75. [clip] = beforeGrayworld(clip)
  76. # clip current meta; color space: YUV422P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: progressive, full height: true
  77. # Denoising using QTGMC
  78. clip = qtgmc.QTGMC(clip, Preset="Fast", InputType=3, TR2=1, TFF=False, SourceMatch=0, Lossless=0)
  79. # adjusting output color from YUV422P8 to YUV420P10 for NVEncModel
  80. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10)
  81. # set output frame rate to 25fps (progressive)
  82. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  83. # output
  84. clip.set_output()
  85. # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 720x576, fps: 25, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
  86. # script was created by Hybrid 2026.09.12.1
Advertisement
Add Comment
Please, Sign In to add comment