Advertisement
Guest User

wobbly1

a guest
Oct 25th, 2023
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.40 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/FrameFilter/ReduceFlicker/ReduceFlicker.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DerainbowFilter/SmoothUV/libsmoothuv.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libtemporalmedian.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  28. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  29. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
  30. # Import scripts
  31. import RainbowSmooth
  32. import SpotLess
  33. import havsfunc
  34. # source: 'C:\Users\Selur\Desktop\sample.mov'
  35. # current color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: bottom field first
  36. # Loading C:\Users\Selur\Desktop\sample.mov using LWLibavSource
  37. clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/sample.mov", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
  38. # Setting detected color matrix (470bg).
  39. clip = core.std.SetFrameProps(clip, _Matrix=5)
  40. # Setting color transfer info (470bg), when it is not set
  41. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  42. # Setting color primaries info (BT.601 PAL), when it is not set
  43. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
  44. # Setting color range to TV (limited) range.
  45. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  46. # making sure frame rate is set to 25
  47. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  48. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=1) # bff
  49. # Deinterlacing using QTGMC
  50. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False, opencl=True) # new fps: 50
  51. # Making sure content is preceived as frame based
  52. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  53. # adjusting color space from YUV420P8 to YUV444P16 for vsGLSLSaturation
  54. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
  55. with open("F:/Hybrid/64bit/vsfilters/GLSL/parameterized/bSat.hook.glsl") as glslf:
  56. glsl = glslf.read()
  57. glsl = glsl.replace('#define SatFactor 2.43', '#define SatFactor 0.90')
  58. clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
  59. clip = core.std.CropRel(clip=clip, left=14, right=20, top=4, bottom=0)# cropping to 686x572
  60. # adjusting color space from YUV444P16 to RGB48 for vsLevels
  61. clip = core.resize.Bicubic(clip=clip, format=vs.RGB48, matrix_in_s="470bg", range_s="limited")
  62. # Color Adjustment using Levels on RGB48 (16 bit)
  63. clip = core.std.Levels(clip=clip, min_in=4096, max_in=60160, min_out=4096, max_out=60160, gamma=0.85)
  64. # adjusting color space from RGB48 to YUV444P16 for vsSpotLess
  65. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited")
  66. # Spot removal using SpotLess
  67. clip = SpotLess.SpotLess(clip=clip, radT=3, rec=True, pel=1)
  68. # adjusting color space from YUV444P16 to YUV444P8 for vsRainbowSmooth
  69. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, range_s="limited", dither_type="error_diffusion")
  70. # rainbow removal using RainbowSmooth
  71. clip = RainbowSmooth.RainbowSmooth(clip=clip, radius=5)
  72. clip = havsfunc.DeHalo_alpha(clip, ry=3.00, brightstr=0.00, rx=3.00, darkstr=2.00)
  73. # removing flickering using ReduceFlicker
  74. clip = core.rdfl.ReduceFlicker(clip=clip, strength=3, aggressive=1)
  75. # removing flickering using ReduceFlicker
  76. clip = core.rdfl.ReduceFlicker(clip=clip, strength=3, aggressive=1)
  77. # removing flickering using ReduceFlicker
  78. clip = core.rdfl.ReduceFlicker(clip=clip, strength=3, aggressive=1)
  79. # Resizing using 10 - bicubic spline
  80. clip = core.fmtc.resample(clip=clip, kernel="spline16", w=704, h=550, interlaced=False, interlacedd=False) # resolution 704x550 before YUV444P8 after YUV444P16
  81. # adjusting output color from: YUV444P16 to YUV420P10 for NVEncModel
  82. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited", dither_type="error_diffusion")
  83. # set output frame rate to 50fps (progressive)
  84. clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
  85. # Output
  86. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement