Guest User

Untitled

a guest
Feb 1st, 2024
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 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/Support/libsangnom.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI2.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.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 mvsfunc
  32. import havsfunc
  33. # source: 'C:\Users\Selur\Desktop\rail - clip 01.avi'
  34. # current color space: YUV422P10, bit depth: 10, resolution: 720x480, fps: 29.97, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg
  35. # Loading C:\Users\Selur\Desktop\rail - clip 01.avi using LWLibavSource
  36. clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/rail - clip 01.avi", format="YUV422P10", stream_index=0, cache=0, prefer_hw=0)
  37. frame = clip.get_frame(0)
  38. # Setting detected color matrix (470bg).
  39. clip = core.std.SetFrameProps(clip, _Matrix=5)
  40. # Setting color transfer (170), if it is not set.
  41. if '_Transfer' not in frame.props or not frame.props['_Transfer']:
  42. clip = core.std.SetFrameProps(clip, _Transfer=6)
  43. # Setting color primaries info (to 470), if it is not set.
  44. if '_Primaries' not in frame.props or not frame.props['_Primaries']:
  45. clip = core.std.SetFrameProps(clip, _Primaries=5)
  46. # Setting color range to TV (limited) range.
  47. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  48. # making sure frame rate is set to 29.97
  49. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  50. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2) # tff
  51. # Deinterlacing using QTGMC
  52. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False, opencl=True) # new fps: 59.94
  53. # Making sure content is preceived as frame based
  54. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  55. # applying dehalo using YAHR
  56. clip = havsfunc.YAHR(clip, blur=1, depth=16)
  57. clip = havsfunc.YAHR(clip, blur=1, depth=16)
  58. clip = havsfunc.YAHR(clip, blur=1, depth=16)
  59. # applying anti aliasing using santiag
  60. clip = havsfunc.santiag(c=clip, strh=2, strv=2, nns=3, pscrn=2, opencl=True)
  61. # adjusting output color from: YUV422P10 to YUV420P10 for NVEncModel
  62. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
  63. # set output frame rate to 59.94fps (progressive)
  64. clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
  65. # Output
  66. clip.set_output()
Add Comment
Please, Sign In to add comment