Guest User

Untitled

a guest
Nov 29th, 2022
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 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("i:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  7. import sys
  8. # getting Vapoursynth core
  9. core = vs.core
  10. # Import scripts folder
  11. scriptPath = 'i:/Hybrid/64bit/vsscripts'
  12. sys.path.insert(0, os.path.abspath(scriptPath))
  13. # Loading Plugins
  14. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
  15. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools_sf_em64t.dll")
  16. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/TCanny.dll")
  17. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libtemporalmedian.dll")
  18. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/HQDN3D/libhqdn3d.dll")
  19. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/DePan.dll")
  20. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ColorFilter/Retinex/Retinex.dll")
  21. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  22. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  23. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
  24. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  25. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
  26. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  27. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  28. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  29. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  30. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  31. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  32. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
  33. # Import scripts
  34. import G41Fun
  35. import SpotLess
  36. import masked
  37. import lostfunc
  38. import havsfunc
  39. # source: 'C:\Users\Selur\Desktop\Oxford Sample 2.avi'
  40. # current color space: YUV411P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: bottom field first
  41. # Loading C:\Users\Selur\Desktop\Oxford Sample 2.avi using LWLibavSource
  42. clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/Oxford Sample 2.avi", format="YUV411P8", stream_index=0, cache=0, prefer_hw=2)
  43. # Setting color matrix to 470bg.
  44. clip = core.std.SetFrameProps(clip, _Matrix=5)
  45. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  46. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
  47. # Setting color range to TV (limited) range.
  48. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  49. # making sure frame rate is set to 29.970
  50. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  51. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=1)
  52. # adjusting color space from YUV411P8 to YUV444P8 for VsQTGMC
  53. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, range_s="limited")
  54. # setting field order to what QTGMC should assume (bottom field first)
  55. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=1)
  56. # Deinterlacing using QTGMC
  57. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False, opencl=True) # new fps: 59.94
  58. # make sure content is preceived as frame based
  59. clip = core.std.SetFieldBased(clip, 0)
  60. # color adjustment using Retinex
  61. clip = core.retinex.MSRCP(input=clip, sigma=[40,120,250], lower_thr=0.200, fulls=False, fulld=False, chroma_protect=1.500)
  62. # adjusting color space from YUV444P8 to RGB24 for vsLevels
  63. clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
  64. # Color Adjustment using Levels on RGB24 (8 bit)
  65. clip = core.std.Levels(clip=clip, min_in=16, max_in=235, min_out=16, max_out=235, gamma=0.90)
  66. # adjusting color space from RGB24 to YUV444P8 for vsStab
  67. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="limited")
  68. # stabilizing using Stab
  69. clip = lostfunc.Stab(clp=clip,range=3,mirror=0)
  70. # cropping the video to 704x480
  71. clip = core.std.CropRel(clip=clip, left=8, right=8, top=0, bottom=0)
  72. ## Starting applying 'limit' masked filtering for vsHQDN3D
  73. clipMask = clip
  74. clipMask = core.std.BinarizeMask(clipMask, 50, planes=[0])
  75. clipMask = core.std.InvertMask(clipMask)
  76. clipFiltered = clip
  77. # denoising using HQDN3D
  78. clipFiltered = core.hqdn3d.Hqdn3d(clip=clipFiltered, lum_spac=24.00, lum_tmp=54.00)
  79. clip = core.std.MaskedMerge(clip, clipFiltered, clipMask)
  80. ## Finished applying 'limit' masked filtering for vsHQDN3D
  81. clip = SpotLess.SpotLess(clip=clip, radT=3)
  82. # removing grain using TemporalDegrain2
  83. clip = G41Fun.TemporalDegrain2(clip=clip, degrainPlane=4, meAlgPar=False, meTM=True, postFFT=0, fftThreads=1)
  84. # adjusting output color from: YUV444P8 to YUV420P10 for NVEncModel
  85. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
  86. # set output frame rate to 59.94fps
  87. clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
  88. # Output
  89. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment