Advertisement
Guest User

Untitled

a guest
May 19th, 2025
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.13 KB | None | 0 0
  1. # Imports
  2. import vapoursynth as vs
  3. # getting Vapoursynth core
  4. import ctypes
  5. import sys
  6. import os
  7. core = vs.core
  8. # Import scripts folder
  9. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  10. sys.path.insert(0, os.path.abspath(scriptPath))
  11. # Loading Support Files
  12. Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  13. # loading plugins
  14. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libdescale.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/dfttest2_nvrtc.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/vszip.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/DePan.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/RemapFramesVapoursynth.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  28. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")# vsQTGMC
  29. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  30. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  31. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  32. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  33. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/akarin.dll")
  34. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
  35. # Import scripts
  36. import edi_rpow2
  37. import deband
  38. import dfttest2
  39. import nnedi3_resample
  40. import smdegrain
  41. import dehalo
  42. import masked
  43. import sharpen
  44. import stabilize
  45. import fromDoom9
  46. import qtgmc
  47. import validate
  48. # Source: 'C:\Users\Selur\Desktop\clip- as captured.avi'
  49. # Current color space: YUV422P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg, format: HuffYUV
  50. # Loading C:\Users\Selur\Desktop\clip- as captured.avi using LWLibavSource
  51. clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/clip- as captured.avi", format="YUV422P8", stream_index=0, cache=0, prefer_hw=0)
  52. frame = clip.get_frame(0)
  53. # setting color matrix to 470bg.
  54. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
  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: top field first)
  66. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # tff
  67. # Deinterlacing using QTGMC
  68. clip = qtgmc.QTGMC(Input=clip, Preset="Fast", TFF=True, opencl=True) # new fps: 59.94
  69. # Making sure content is preceived as frame based
  70. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
  71. # adjusting color space from YUV422P8 to RGBS for vsChangeTemperature
  72. clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
  73. # adjusting colors using ChangeTemperature
  74. clip = core.remap.Rfs(baseclip=clip, sourceclip=fromDoom9.change_temperature(clip=clip, temp=10000), mappings="[1286 2393]")
  75. # adjusting color space from RGBS to YUV444P16 for vsStab
  76. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
  77. # stabilizing using Stab
  78. clip = stabilize.Stab(clp=clip,range=3,mirror=0)
  79. clip = core.std.Crop(clip=clip, left=12, right=10, top=2, bottom=6)# cropping to 698x472
  80. # contrast sharpening using CAS
  81. clip = core.cas.CAS(clip=clip)
  82. # sharpening using DetailSharpen
  83. clip = sharpen.DetailSharpen(clip=clip, mode=0)
  84. ## Starting applying 'EdgeMask (Bloated)' masked filtering for vsAWarpSharp2
  85. clipMask = clip
  86. clipMask = core.std.ShufflePlanes(clips=[clipMask], planes=[0], colorfamily=vs.GRAY)
  87. clipMask = masked.bloated_edgemask(src=clipMask)
  88. clipMask = core.std.ShufflePlanes(clips=[clipMask], planes=[0], colorfamily=vs.GRAY)
  89. clipFiltered = clip
  90. # sharpening using AWarpSharp2
  91. clipFiltered = core.warp.AWarpSharp2(clip=clipFiltered, blur=2, planes=[0])
  92. clip = core.std.MaskedMerge(clip, clipFiltered, clipMask) # BloatedEdgeMask
  93. ## Finished applying 'BloatedEdgeMask' masked filtering for vsAWarpSharp2
  94. # applying dehalo using DeHalo_alpha
  95. clip = dehalo.DeHalo_alpha(clip, rx=2.50, ry=2.50)
  96. # removing grain using SMDegrain
  97. clip = smdegrain.SMDegrain(input=clip, tr=3, thSAD=600, thSADC=256, contrasharp=10, interlaced=False, prefilter=3, opencl=True, device=-1)
  98. # debanding using GradFun3
  99. clip = deband.GradFun3(src=clip)
  100. # Resizing using 10 - bicubic spline
  101. clip = core.fmtc.resample(clip=clip, kernel="spline16", w=1280, h=866, interlaced=False, interlacedd=False) # resolution 1280x866 before YUV444P16 after YUV444P16
  102. # adjusting output color from: YUV444P16 to YUV420P10 for NVEncModel
  103. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited", dither_type="error_diffusion")
  104. # set output frame rate to 59.94fps (progressive)
  105. clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
  106. # output
  107. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement