Guest User

Untitled

a guest
Mar 10th, 2023
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.20 KB | None | 0 0
  1. # Imports
  2. import vapoursynth as vs
  3. import os
  4. import ctypes
  5. # Loading Support Files
  6. Dllref = ctypes.windll.LoadLibrary("i:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  7. import sys
  8. # getting Vapoursynth core
  9. core = vs.core
  10. # Import scripts folder
  11. scriptPath = 'i:/Hybrid/64bit/vsscripts'
  12. sys.path.insert(0, os.path.abspath(scriptPath))
  13. # Loading Plugins
  14. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
  15. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
  16. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools_sf_em64t.dll")
  17. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/TCanny.dll")
  18. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
  19. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DerainbowFilter/SmoothUV/libsmoothuv.dll")
  20. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeCrawlFilter/DotKill/DotKill.dll")
  21. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
  22. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  23. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  24. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  25. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  26. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
  27. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  28. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  29. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  30. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  31. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  32. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  33. # Import scripts
  34. import G41Fun
  35. import RainbowSmooth
  36. import havsfunc
  37. # source: 'C:\Users\Selur\Desktop\TEP_Sample.mkv'
  38. # current color space: YUV420P8, bit depth: 8, resolution: 716x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: telecine
  39. # Loading C:\Users\Selur\Desktop\TEP_Sample.mkv using DGSource
  40. clip = core.dgdecodenv.DGSource("J:/tmp/mkv_76e0b0e3e8fcc29efef26f8a96fafc46_853323747.dgi",fieldop=0)# 29.97 fps, scanorder: telecine
  41. # Setting detected color matrix (470bg).
  42. clip = core.std.SetFrameProps(clip, _Matrix=5)
  43. # Setting color transfer info (470bg), when it is not set
  44. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  45. # Setting color primaries info (BT.601 NTSC), when it is not set
  46. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
  47. # Setting color range to TV (limited) range.
  48. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  49. # making sure frame rate is set to 29.97
  50. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  51. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  52. clip2clip = clip
  53. clip2clip = havsfunc.QTGMC(Input=clip2clip, Preset="fast", opencl=True, TFF=True,FPSDivisor=2)
  54. # Deinterlacing using TIVTC
  55. clip = core.tivtc.TFM(clip=clip, clip2=clip2clip)
  56. clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976
  57. # Making sure content is preceived as frame based
  58. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  59. clip = core.dotkill.DotKillS(clip=clip, iterations=10)
  60. # rainbow removal using RainbowSmooth
  61. clip = RainbowSmooth.RainbowSmooth(clip=clip, radius=4, mask="sobel")
  62. clip = core.std.AddBorders(clip=clip, left=0, right=4, top=0, bottom=0) # add borders to archive mod 8 (vsBasicVSRPPFilter) - 720x480
  63. # adjusting color space from YUV420P8 to RGBS for vsBasicVSRPPFilter
  64. clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
  65. # Quality enhancement using BasicVSR++
  66. from vsbasicvsrpp import BasicVSRPP
  67. clip = BasicVSRPP(clip=clip, model=3, interval=1, fp16=True)
  68. clip = core.std.CropRel(clip=clip, left=0, right=4, top=0, bottom=0) # removing borders (vsBasicVSRPPFilter) - 716x480
  69. # adjusting color space from RGBS to YUV444P16 for vsGLSLDarken
  70. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
  71. # Using Anime4k Darken GLSL filter for line darkening
  72. with open("i:/Hybrid/64bit/vsfilters/GLSL/parameterized/Anime4K_Darken_HQ.glsl") as glslf:
  73. glsl = glslf.read()
  74. glsl = glsl.replace('#define STRENGTH 1.5', '#define STRENGTH 1.5')
  75. clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
  76. # removing grain using TemporalDegrain2
  77. clip = G41Fun.TemporalDegrain2(clip=clip, degrainPlane=4, meAlgPar=False, postFFT=0, fftThreads=1)
  78. # adjusting output color from: YUV444P16 to YUV420P10 for NVEncModel
  79. clip = core.resize.Bicubic(clip=clip, dither_type="error_diffusion", format=vs.YUV420P10, range_s="limited")
  80. # set output frame rate to 23.976fps
  81. clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
  82. # Output
  83. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment