Advertisement
Guest User

Untitled

a guest
Nov 11th, 2023
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.31 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/Support/Bilateral.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/RemoveDirt/RemoveDirtVS.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DebandFilter/Flash3kDeband/flash3kyuu_deband.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/ReduceFlicker/ReduceFlicker.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/TTempSmooth/TTempSmooth.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/DCTFilter.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeblockFilter/Deblock/Deblock.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/EdgeFixer/EdgeFixer.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libtemporalmedian.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  28. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  29. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  30. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
  31. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  32. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  33. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  34. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  35. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  36. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  37. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  38. # Import scripts
  39. import edi_rpow2
  40. import fvsfunc
  41. import muvsfunc
  42. import killerspots
  43. import SpotLess
  44. import chromashift
  45. import havsfunc
  46. # source: 'C:\Users\Selur\Desktop\file (1).mkv'
  47. # current color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
  48. # Loading C:\Users\Selur\Desktop\file (1).mkv using DGSource
  49. clip = core.dgdecodenv.DGSource("J:/tmp/mkv_ff72f3940f41642c8b647b89122c1267_853323747.dgi",fieldop=0)# 29.97 fps, scanorder: top field first
  50. # Setting detected color matrix (470bg).
  51. clip = core.std.SetFrameProps(clip, _Matrix=5)
  52. # Setting color transfer info (470bg), when it is not set
  53. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  54. # Setting color primaries info (), when it is not set
  55. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
  56. # Setting color range to TV (limited) range.
  57. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  58. # making sure frame rate is set to 29.97
  59. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  60. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2) # tff
  61. # Deinterlacing using QTGMC
  62. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True, opencl=True) # new fps: 59.94
  63. # Making sure content is preceived as frame based
  64. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  65. # adjusting color space from YUV420P8 to YUV444P16 for vsGLSLSaturation
  66. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
  67. with open("F:/Hybrid/64bit/vsfilters/GLSL/parameterized/bSat.hook.glsl") as glslf:
  68. glsl = glslf.read()
  69. glsl = glsl.replace('#define SatFactor 2.43', '#define SatFactor 0.90')
  70. clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
  71. # Chroma adjustment using ChromaShiftSP
  72. clip = chromashift.ChromaShiftSP(clip=clip, Y=2.50)
  73. # Spot removal using SpotLess
  74. clip = SpotLess.SpotLess(clip=clip, radT=3, pel=1)
  75. clip = core.std.CropRel(clip=clip, left=6, right=14, top=0, bottom=0)# cropping to 700x480
  76. # Fix bright and dark line artifacts near the border of an image using BalanceBorders
  77. clip = havsfunc.bbmod(c=clip,cLeft=8,cTop=0,cRight=0,cBottom=4)
  78. # Fix bright and dark line artifacts near the border of an image using EdgeFixer
  79. clip = core.edgefixer.Continuity(clip=clip,bottom=16,radius=3)
  80. # denoising using MCTemporalDenoise
  81. clip = havsfunc.MCTemporalDenoise(i=clip, settings="very high", ncpu=10)
  82. # removing flickering using ReduceFlicker
  83. clip = core.rdfl.ReduceFlicker(clip=clip, strength=3, aggressive=1)
  84. # debanding using f3kdb
  85. clip = core.f3kdb.Deband(clip, dynamic_grain=True, keep_tv_range=True, output_depth=16)
  86. clip = havsfunc.DeHalo_alpha(clip, darkstr=0.00)
  87. clip = core.std.AddBorders(clip=clip, left=10, right=10, top=8, bottom=8) # add borders to archive mod 8 (vsKillerSpots) - 720x496
  88. # adjusting color space from YUV444P16 to YUV420P8 for vsKillerSpots
  89. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited", dither_type="error_diffusion")
  90. clip = killerspots.KillerSpots(clip=clip, advanced=False)
  91. clip = core.std.CropRel(clip=clip, left=10, right=10, top=8, bottom=8) # removing borders (vsKillerSpots) - 700x480
  92. # Resizing using 10 - bicubic spline
  93. clip = core.fmtc.resample(clip=clip, kernel="spline16", w=720, h=494, interlaced=False, interlacedd=False) # resolution 720x494 before YUV420P8 after YUV420P16
  94. # debanding using GradFun3
  95. clip = fvsfunc.GradFun3(src=clip)
  96. # adjusting output color from: YUV420P16 to YUV420P10 for NVEncModel
  97. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited", dither_type="error_diffusion")
  98. # set output frame rate to 59.94fps (progressive)
  99. clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
  100. # Output
  101. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement