Advertisement
Guest User

going a bit crazy

a guest
Nov 27th, 2023
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 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/TTempSmooth/TTempSmooth.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/DCTFilter.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeblockFilter/Deblock/Deblock.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libtemporalmedian.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 SpotLess
  32. import havsfunc
  33. # source: 'C:\Users\Selur\Desktop\Sample Video.avi'
  34. # current color space: YUV422P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
  35. # Loading C:\Users\Selur\Desktop\Sample Video.avi using LWLibavSource
  36. clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/Sample Video.avi", format="YUV422P8", stream_index=0, cache=0, prefer_hw=0)
  37. # Setting detected color matrix (470bg).
  38. clip = core.std.SetFrameProps(clip, _Matrix=5)
  39. # Setting color transfer info (470bg), when it is not set
  40. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  41. # Setting color primaries info (), when it is not set
  42. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
  43. # Setting color range to TV (limited) range.
  44. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  45. # making sure frame rate is set to 25
  46. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  47. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2) # tff
  48. # Deinterlacing using QTGMC
  49. clip = havsfunc.QTGMC(Input=clip, Preset="Faster", TFF=True, opencl=True) # new fps: 50
  50. # Making sure content is preceived as frame based
  51. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  52. clip = core.std.CropRel(clip=clip, left=10, right=14, top=0, bottom=8)# cropping to 696x568
  53. # changing range from limited to full range
  54. clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
  55. # Setting color range to PC (full) range.
  56. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
  57. # adjusting color space from YUV422P8 to RGB24 for vsCodeFormer
  58. clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="full")
  59. # Blind Face Restoration using CodeFormer
  60. from vscodeformer import codeformer as CodeFormer
  61. clip = CodeFormer(clip=clip, upscale=1, weight=1.000) # 696x568
  62. # changing range from full to limited range
  63. clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
  64. # adjusting color space from RGB24 to YUV444P8 for vsSpotLess
  65. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="full")
  66. # Spot removal using SpotLess
  67. clip = SpotLess.SpotLess(clip=clip, radT=3, pel=1)
  68. # denoising using MCTemporalDenoise
  69. clip = havsfunc.MCTemporalDenoise(i=clip, settings="very high", ncpu=1)
  70. from vsscunet import scunet as SCUNet
  71. # adjusting color space from YUV444P8 to RGBS for vsSCUNet
  72. clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="full")
  73. # denoising using SCUNet
  74. clip = SCUNet(clip=clip, model=4, cuda_graphs=True)
  75. # adjusting output color from: RGBS to YUV420P10 for NVEncModel
  76. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="full", dither_type="error_diffusion")
  77. # set output frame rate to 50fps (progressive)
  78. clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
  79. # Output
  80. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement