Advertisement
Guest User

Untitled

a guest
Jan 27th, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 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/EEDI3m.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  25. # defining beforeQTGMCFilter-function - START
  26. def beforeQTGMCFilter(clip):
  27. clip = core.std.Transpose(clip)
  28. return clip
  29. # defining beforeQTGMCFilter-function - END
  30.  
  31. # defining beforeCnr2-function - START
  32. def beforeCnr2(clip):
  33. clip = core.std.Transpose(clip)
  34. return clip
  35. # defining beforeCnr2-function - END
  36.  
  37. # Import scripts
  38. import havsfunc
  39. # source: 'C:\Users\Selur\Desktop\sample.mkv'
  40. # current color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
  41. # Loading C:\Users\Selur\Desktop\sample.mkv using DGSource
  42. clip = core.dgdecodenv.DGSource("J:/tmp/mkv_db12488da61ced703c8f93b70430eca5_853323747.dgi")# 25 fps, scanorder: progressive
  43. frame = clip.get_frame(0)
  44. # Setting detected color matrix (470bg).
  45. clip = core.std.SetFrameProps(clip, _Matrix=5)
  46. # Setting color transfer (to 470bg), if it is not set.
  47. if '_Transfer' not in frame.props or not frame.props['_Transfer']:
  48. clip = core.std.SetFrameProps(clip, _Transfer=5)
  49. # Setting color primaries info (to 5), if it is not set.
  50. if '_Primaries' not in frame.props or not frame.props['_Primaries']:
  51. clip = core.std.SetFrameProps(clip, _Primaries=5)
  52. # Setting color range to TV (limited) range.
  53. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  54. # making sure frame rate is set to 25
  55. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  56. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  57. clip = beforeQTGMCFilter(clip)
  58. # Denoising using QTGMC
  59. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", InputType=3, TR2=1, TFF=False, SourceMatch=0, Lossless=0)
  60. clip = beforeCnr2(clip)
  61. # adjusting output color from: YUV420P8 to YUV420P10 for NVEncModel
  62. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
  63. # set output frame rate to 25fps (progressive)
  64. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  65. # Output
  66. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement