Guest User

Untitled

a guest
Sep 8th, 2023
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.79 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("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  7. import sys
  8. # getting Vapoursynth core
  9. core = vs.core
  10. # Import scripts folder
  11. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  12. sys.path.insert(0, os.path.abspath(scriptPath))
  13. # Loading Plugins
  14. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/ReduceFlicker/ReduceFlicker.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libtemporalmedian.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/EdgeFixer/EdgeFixer.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/LGhost/LGhost.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  28. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  29. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  30. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
  31. # Import scripts
  32. import SpotLess
  33. import havsfunc
  34. # source: 'C:\Users\Selur\Desktop\Queen - Freddie Mercury Tribute BBC intro.PF6qPtBV.avi.part'
  35. # current color space: YUV422P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
  36. # Loading C:\Users\Selur\Desktop\Queen - Freddie Mercury Tribute BBC intro.PF6qPtBV.avi.part using LWLibavSource
  37. clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/Queen - Freddie Mercury Tribute BBC intro.PF6qPtBV.avi.part", format="YUV422P8", 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 (), 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=2) # tff
  49. # Deinterlacing using QTGMC
  50. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True, 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. clip = core.lghost.LGhost(clip, mode=[2], shift=[19], intensity=[-10])
  54. # adjusting color space from YUV422P8 to RGB24 for vsLevels
  55. clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
  56. # Color Adjustment using Levels on RGB24 (8 bit)
  57. clip = core.std.Levels(clip=clip, min_in=16, max_in=235, min_out=16, max_out=235, gamma=1.20)
  58. clip = core.std.CropRel(clip=clip, left=38, right=12, top=2, bottom=2)# cropping to 670x572
  59. # adjusting color space from RGB24 to YUV444P8 for vsEdgeFixer
  60. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="limited")
  61. # Fix bright and dark line artifacts near the border of an image using EdgeFixer
  62. clip = core.edgefixer.Continuity(clip=clip,bottom=6,radius=1)
  63. # Fix bright and dark line artifacts near the border of an image using BalanceBorders
  64. clip = havsfunc.bbmod(c=clip,cLeft=0,cTop=0,cRight=0,cBottom=12)
  65. # Spot removal using SpotLess
  66. clip = SpotLess.SpotLess(clip=clip, radT=3, pel=4)
  67. # removing flickering using ReduceFlicker
  68. clip = core.rdfl.ReduceFlicker(clip=clip, strength=3, aggressive=1)
  69. # changing range from limited to full range
  70. clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
  71. # Setting color range to PC (full) range.
  72. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
  73. # adjusting color space from YUV444P8 to RGB24 for vsCodeFormer
  74. clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="full")
  75. # Blind Face Restoration using CodeFormer
  76. from vscodeformer import codeformer as CodeFormer
  77. clip = CodeFormer(clip=clip, upscale=1, weight=1.000) # 670x572
  78. # changing range from full to limited range
  79. clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
  80. # Setting color range to TV (limited) range.
  81. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  82. # contrast sharpening using CAS
  83. clip = core.cas.CAS(clip=clip, sharpness=0.650)
  84. # Resizing using 10 - bicubic spline
  85. clip = core.fmtc.resample(clip=clip, kernel="spline16", w=720, h=616, interlaced=False, interlacedd=False) # resolution 720x616 before RGB24 after RGB48
  86. # adjusting output color from: RGB48 to YUV420P10 for NVEncModel
  87. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
  88. # set output frame rate to 50fps (progressive)
  89. clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
  90. # Output
  91. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment