Guest User

Untitled

a guest
Jun 26th, 2025
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 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/EEDI3m_opencl.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/akarin.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
  26. # Import scripts
  27. import qtgmc
  28. import validate
  29. # Source: 'C:\Users\Selur\Desktop\Sample 1 minute.mkv'
  30. # Current color space: YUV420P8, bit depth: 8, resolution: 960x540, frame rate: 29.97fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, format: AVC
  31. # Loading C:\Users\Selur\Desktop\Sample 1 minute.mkv using DGSource
  32. clip = core.dgdecodenv.DGSource("J:/tmp/mkv_271e29390977cb21bf00b12d9fbb91ff_853323747.dgi")# 29.97 fps, scanorder: progressive
  33. frame = clip.get_frame(0)
  34. # setting color matrix to 709.
  35. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
  36. # setting color transfer (vs.TRANSFER_BT601), if it is not set.
  37. if validate.transferIsInvalid(clip):
  38. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
  39. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  40. if validate.primariesIsInvalid(clip):
  41. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  42. # setting color range to TV (limited) range.
  43. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
  44. # making sure frame rate is set to 29.97fps
  45. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  46. # making sure the detected scan type is set (detected: progressive)
  47. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
  48. clip = core.std.Crop(clip=clip, left=0, right=0, top=0, bottom=4)# cropping to 960x536
  49. clip = core.fmtc.resample(clip=clip, w=640, h=480, kernel="cubic", interlaced=False, interlacedd=False) # resizing for 'Gimmick' (vsQTGMCFilter)
  50. # Denoising using QTGMC
  51. clip = qtgmc.QTGMC(Input=clip, Preset="Fast", InputType=3, TR2=1, TFF=False, SourceMatch=0, Lossless=0, opencl=True)
  52. clip = core.fmtc.resample(clip=clip, w=960, h=536, kernel="cubic", interlaced=False, interlacedd=False) # undo resizing for 'Gimmick' (vsQTGMCFilter)
  53. clip = core.std.AddBorders(clip=clip, left=0, right=0, top=4, bottom=4) # add borders to archive mod 16 (vsSangNom) - 960x544
  54. # applying AA using SangNom
  55. clip = core.sangnom.SangNom(clip=clip, aa=[48,0])
  56. clip = core.std.Crop(clip=clip, left=0, right=0, top=4, bottom=4) # removing borders (vsSangNom) - 960x536
  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 29.97fps (progressive)
  60. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  61. # output
  62. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment