Advertisement
Guest User

Untitled

a guest
Jun 29th, 2023
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. # Imports
  2. import vapoursynth as vs
  3. import os
  4. import ctypes
  5. # Loading Support Files
  6. Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  7. import sys
  8. # getting Vapoursynth core
  9. core = vs.core
  10. # Import scripts folder
  11. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  12. sys.path.insert(0, os.path.abspath(scriptPath))
  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")
  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/scenechange.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/d2vSource/DGDecode.dll")
  26. # defining beforeDeCross-function - START
  27. def beforeDeCross(clip):
  28. # requires colorformat RGB24
  29. import rgbAdjust
  30. clip = rgbAdjust.RGBAdjust(rgb=clip, r=1.0, g=1.0, b=1.0, a=1.0, rb=1.0, gb=1.0, bb=0.0, ab=0.0, rg=1.0, gg=1.0, bg=1.0, ag=1.0)
  31. return clip
  32. # defining beforeDeCross-function - END
  33.  
  34. # Import scripts
  35. import havsfunc
  36. # source: 'C:\Users\Selur\Desktop\pan_shot.demuxed.m2v'
  37. # current color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
  38. # Loading C:\Users\Selur\Desktop\pan_shot.demuxed.m2v using DGDecode
  39. clip = core.dgdecode.MPEG2Source("J:/tmp/m2v_a79d947ff92e051deeea696f65e89c07_853323747.d2v",info=3)# 29.97 fps, scanorder: top field first
  40. # Setting detected color matrix (470bg).
  41. clip = core.std.SetFrameProps(clip, _Matrix=5)
  42. # Setting color transfer info (470bg), when it is not set
  43. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  44. # Setting color primaries info (), when it is not set
  45. clip = clip if not core.text.FrameProps(clip,'_Primaries') else 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. # adjusting color format to RGB24 for custom section
  52. clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
  53. clip = beforeDeCross(clip)
  54. # adjusting color space from RGB24 to YUV444P8 for vsQTGMC
  55. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="limited")
  56. # Deinterlacing using QTGMC
  57. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True, opencl=True) # new fps: 59.94
  58. # Making sure content is preceived as frame based
  59. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  60. # adjusting output color from: YUV444P8 to YUV420P8 for x264Model
  61. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited")
  62. # set output frame rate to 59.94fps (progressive)
  63. clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
  64. # Output
  65. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement