Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2025
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 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/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")# vsQTGMC
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  25. # Import scripts
  26. import havsfunc
  27. import validate
  28. # Source: 'C:\Users\Selur\Desktop\SampleSlowMotion.m2v'
  29. # Current color space: YUV420P8, bit depth: 8, resolution: 720x576, frame rate: 25fps, scanorder: bottom field first, yuv luminance scale: limited, matrix: 470bg, format: mpeg-2
  30. # Loading C:\Users\Selur\Desktop\SampleSlowMotion.m2v using DGSource
  31. clip = core.dgdecodenv.DGSource("J:/tmp/m2v_89c4bff806ba156959ee6cb3e488895d_853323747.dgi",fieldop=0)# 25 fps, scanorder: bottom field first
  32. frame = clip.get_frame(0)
  33. # setting color matrix to 470bg.
  34. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
  35. # setting color transfer (vs.TRANSFER_BT601), if it is not set.
  36. if validate.transferIsInvalid(clip):
  37. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
  38. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  39. if validate.primariesIsInvalid(clip):
  40. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  41. # setting color range to TV (limited) range.
  42. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
  43. # making sure frame rate is set to 25fps
  44. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  45. # making sure the detected scan type is set (detected: bottom field first)
  46. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_BOTTOM) # bff
  47. # Deinterlacing using QTGMC
  48. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False, opencl=True) # new fps: 50
  49. # Making sure content is preceived as frame based
  50. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
  51. # adjusting frame with SelectEvery
  52. clip = core.std.SelectEvery(clip=clip, cycle=8, offsets=[1, 2])
  53. clip = core.std.AssumeFPS(clip=clip,fpsnum=12000, fpsden=960)# new fps: 12.5
  54. clip = core.std.Crop(clip=clip, left=30, right=32, top=0, bottom=8)# cropping to 658x568
  55. # Resizing using 10 - bicubic spline
  56. clip = core.fmtc.resample(clip=clip, kernel="spline16", w=704, h=570, interlaced=False, interlacedd=False) # resolution 704x570 before YUV420P8 after YUV420P16
  57. # adjusting output color from: YUV420P16 to YUV420P10 for NVEncModel
  58. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited", dither_type="error_diffusion")
  59. # set output frame rate to 25fps (progressive) due to 'Change speed
  60. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  61. # output
  62. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement