Guest User

Untitled

a guest
Jun 16th, 2024
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 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/DenoiseFilter/DGDenoise/DGDenoise.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/TTempSmooth/TTempSmooth.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/DCTFilter.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeblockFilter/Deblock/Deblock.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/Interframe/svpflow2_vs64.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/Interframe/svpflow1_vs64.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/RemoveDirt/RemoveDirtVS.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")# vsQTGMC
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  28. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  29. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  30. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  31. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  32. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  33. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
  34. # Import scripts
  35. import removeDirt
  36. import SpotLess
  37. import havsfunc
  38. import validate
  39. # Source: 'C:\Users\Selur\Desktop\Example.avi'
  40. # Current color space: YUV422P8, bit depth: 8, resolution: 704x576, frame rate: 25fps, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg
  41. # Loading C:\Users\Selur\Desktop\Example.avi using LWLibavSource
  42. clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/Example.avi", format="YUV422P8", stream_index=0, cache=0, prefer_hw=0)
  43. frame = clip.get_frame(0)
  44. # Setting detected color matrix (470bg).
  45. clip = core.std.SetFrameProps(clip=clip, _Matrix=5)
  46. # setting color transfer (170), if it is not set.
  47. if validate.transferIsInvalid(clip):
  48. clip = core.std.SetFrameProps(clip=clip, _Transfer=6)
  49. # setting color primaries info (to 470), if it is not set.
  50. if validate.primariesIsInvalid(clip):
  51. clip = core.std.SetFrameProps(clip=clip, _Primaries=5)
  52. # setting color range to TV (limited) range.
  53. clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
  54. # making sure frame rate is set to 25fps
  55. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  56. # making sure the detected scan type is set (detected: top field first)
  57. clip = core.std.SetFrameProps(clip=clip, _FieldBased=2) # tff
  58. # Deinterlacing using QTGMC
  59. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True, opencl=True) # new fps: 50
  60. # Making sure content is preceived as frame based
  61. clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
  62. # Spot removal using SpotLess
  63. clip = SpotLess.SpotLess(clip=clip, radT=3, pel=1, smoother="zsmooth")
  64. clip = core.std.AddBorders(clip=clip, left=8, right=8, top=8, bottom=8) # add borders to archive mod 8 (vsRemoveDirtMC) - 720x592
  65. # adjusting color space from YUV422P8 to YUV420P8 for vsRemoveDirtMC
  66. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited")
  67. # denoising using VsRemoveDirtMC
  68. clip = removeDirt.RemoveDirtMC(input=clip, limit=10, block_over=0, gpu=True)
  69. clip = core.std.CropRel(clip=clip, left=8, right=8, top=8, bottom=8) # removing borders (vsRemoveDirtMC) - 704x576
  70. # denoising using MCTemporalDenoise
  71. clip = havsfunc.MCTemporalDenoise(i=clip, settings="very high", ncpu=10)
  72. # denoising using DGDenoise
  73. clip = core.dgdenoise.DGDenoise(clip=clip, cstrength=0.05, blend=0.50, cblend=0.50)
  74. # adjusting output color from: YUV420P8 to YUV420P10 for NVEncModel
  75. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
  76. # set output frame rate to 50fps (progressive)
  77. clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
  78. # output
  79. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment