Advertisement
Guest User

Untitled

a guest
Jun 16th, 2024
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.28 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/FFT3DFilter/fft3dfilter.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools_sf_em64t.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/TCanny.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")# vsQTGMC
  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/Support/libdescale.dll")
  30. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  31. # Import scripts
  32. import G41Fun
  33. import muvsfunc
  34. import havsfunc
  35. import validate
  36. # Source: 'C:\Users\Selur\Desktop\Dinosaurs! 2024-06-12 16-52-41_trimmed for Selur.mp4'
  37. # Current color space: YUV420P8, bit depth: 8, resolution: 1440x1080, frame rate: 29.97fps, scanorder: top field first, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709
  38. # Loading C:\Users\Selur\Desktop\Dinosaurs! 2024-06-12 16-52-41_trimmed for Selur.mp4 using DGSource
  39. clip = core.dgdecodenv.DGSource("J:/tmp/mp4_c1a4ea90bead655e1a7a3941d2c5d583_853323747.dgi",fieldop=0)# 29.97 fps, scanorder: top field first
  40. frame = clip.get_frame(0)
  41. # Setting detected color matrix (709).
  42. clip = core.std.SetFrameProps(clip=clip, _Matrix=1)
  43. # setting color transfer (709), if it is not set.
  44. if validate.transferIsInvalid(clip):
  45. clip = core.std.SetFrameProps(clip=clip, _Transfer=1)
  46. # setting color primaries info (to 709), if it is not set.
  47. if validate.primariesIsInvalid(clip):
  48. clip = core.std.SetFrameProps(clip=clip, _Primaries=1)
  49. # setting color range to TV (limited) range.
  50. clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
  51. # making sure frame rate is set to 29.97fps
  52. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  53. # making sure the detected scan type is set (detected: top field first)
  54. clip = core.std.SetFrameProps(clip=clip, _FieldBased=2) # tff
  55. # adjusting resolution before deinterlacing
  56. clip = core.descale.Debicubic(src=clip, width=720, height=480, b="0.00", c="0.50")
  57. # Deinterlacing using QTGMC
  58. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True, opencl=True) # new fps: 59.94
  59. # Making sure content is preceived as frame based
  60. clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
  61. # adjusting frame count and rate with sRestore
  62. clip = muvsfunc.srestore(source=clip, frate=18.0000)
  63. clip = core.std.CropRel(clip=clip, left=8, right=12, top=0, bottom=0)# cropping to 700x480
  64. # removing grain using TemporalDegrain2
  65. clip = G41Fun.TemporalDegrain2(clip=clip, degrainPlane=4, meAlgPar=False, postFFT=0, fftThreads=1)
  66. # fallback - adjusting from 700x1080 to output resolution 1420x1080
  67. clip = core.resize.Spline64(clip=clip, width=1420, height=1080) # resolution 1420x1080)
  68. # adjusting output color from: YUV420P8 to YUV420P10 for NVEncModel
  69. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
  70. # set output frame rate to 18fps (progressive)
  71. clip = core.std.AssumeFPS(clip=clip, fpsnum=18, fpsden=1)
  72. # output
  73. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement