Guest User

Untitled

a guest
Nov 15th, 2023
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.46 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/CTMF/CTMF.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/ReduceFlicker/ReduceFlicker.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/RemoveDirt/RemoveDirtVS.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 nnedi3_resample
  32. import mvsfunc
  33. import smdegrain
  34. import fromDoom9
  35. import killerspots
  36. import SpotLess
  37. import havsfunc
  38. # source: 'C:\Users\Selur\Desktop\tape_43_sample.avi'
  39. # current color space: YUV422P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
  40. # Loading C:\Users\Selur\Desktop\tape_43_sample.avi using LWLibavSource
  41. clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/tape_43_sample.avi", format="YUV422P8", stream_index=1, cache=0, prefer_hw=0)
  42. # Setting detected color matrix (470bg).
  43. clip = core.std.SetFrameProps(clip, _Matrix=5)
  44. # Setting color transfer info (470bg), when it is not set
  45. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  46. # Setting color primaries info (), when it is not set
  47. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
  48. # Setting color range to TV (limited) range.
  49. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  50. # making sure frame rate is set to 25
  51. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  52. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2) # tff
  53. # Deinterlacing using QTGMC
  54. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True, opencl=True) # new fps: 50
  55. # Making sure content is preceived as frame based
  56. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  57. # Spot removal using SpotLess
  58. clip = SpotLess.SpotLess(clip=clip, radT=3, pel=1)
  59. clip = core.std.AddBorders(clip=clip, left=8, right=8, top=8, bottom=8) # add borders to archive mod 8 (vsKillerSpots) - 736x592
  60. # adjusting color space from YUV422P8 to YUV420P8 for vsKillerSpots
  61. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited")
  62. clip = killerspots.KillerSpots(clip=clip, advanced=False)
  63. clip = core.std.CropRel(clip=clip, left=8, right=8, top=8, bottom=8) # removing borders (vsKillerSpots) - 720x576
  64. # stabilizing using StabilizeIT
  65. clip = fromDoom9.StabilizeIT(clip=clip,zoomMax=2.00,thSCD2=140)
  66. # removing flickering using ReduceFlicker
  67. clip = core.rdfl.ReduceFlicker(clip=clip, strength=3, aggressive=1)
  68. clip = core.std.CropRel(clip=clip, left=12, right=12, top=4, bottom=8)# cropping to 696x564
  69. # removing grain using SMDegrain
  70. clip = smdegrain.SMDegrain(input=clip, interlaced=False, opencl=True, device=-1)
  71. # adjusting output color from: YUV420P8 to YUV420P10 for NVEncModel
  72. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
  73. # set output frame rate to 50fps (progressive)
  74. clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
  75. # Output
  76. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment