Advertisement
Guest User

Untitled

a guest
Aug 27th, 2022
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.41 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("i:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  7. import sys
  8. # getting Vapoursynth core
  9. core = vs.core
  10. # Import scripts folder
  11. scriptPath = 'i:/Hybrid/64bit/vsscripts'
  12. sys.path.insert(0, os.path.abspath(scriptPath))
  13. # Loading Plugins
  14. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
  15. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/TTempSmooth/TTempSmooth.dll")
  16. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  17. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/DCTFilter.dll")
  18. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeblockFilter/Deblock/Deblock.dll")
  19. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  20. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
  21. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  22. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  23. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
  24. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  25. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")
  26. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
  27. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  28. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  29. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  30. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  31. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
  32. # Import scripts
  33. import chromashift
  34. import havsfunc
  35. # source: 'C:\Users\Selur\Desktop\Q_Sample_problem_borders_T_Shirt_HUFFYUV.avi'
  36. # current color space: YUV422P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: bottom field first
  37. # Loading source using FFMS2
  38. clip = core.ffms2.Source(source="C:/Users/Selur/Desktop/Q_Sample_problem_borders_T_Shirt_HUFFYUV.avi",cachefile="E:/Temp/avi_d69fe69562dc2597758f18b7194fd7d9_853323747.ffindex",format=vs.YUV422P8,alpha=False)
  39. # Setting color matrix to 470bg.
  40. clip = core.std.SetFrameProps(clip, _Matrix=5)
  41. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  42. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
  43. # Setting color range to TV (limited) range.
  44. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  45. # making sure frame rate is set to 25
  46. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  47. # setting field order to what QTGMC should assume (bottom field first)
  48. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=1)
  49. # Deinterlacing using QTGMC
  50. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False) # new fps: 50
  51. # make sure content is preceived as frame based
  52. clip = core.std.SetFieldBased(clip, 0)
  53. # Chroma adjustment using ChromaShiftSP
  54. clip = chromashift.ChromaShiftSP(clip=clip, X=2.00)
  55. # Fixing chroma bleeding using FixChromaBleedingMod
  56. clip = havsfunc.FixChromaBleedingMod(input=clip)
  57. # cropping the video to 692x476
  58. clip = core.std.CropRel(clip=clip, left=14, right=14, top=50, bottom=50)
  59. # applying dehalo using YAHR
  60. clip = havsfunc.YAHR(clip, depth=48)
  61. # denoising using MCTemporalDenoise
  62. clip = havsfunc.MCTemporalDenoise(i=clip, settings="very high", ncpu=1)
  63. # adjusting color space from YUV422P8 to YUV444P16 for vsGLSLFilmGrain
  64. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
  65. with open("i:/Hybrid/64bit/vsfilters/GLSL/parameterized/filmgrain.glsl") as glslf:
  66. glsl = glslf.read()
  67. glsl = glsl.replace('#define INTENSITY 0.05', '#define INTENSITY 0.02')
  68. clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
  69. # adjusting output color from: YUV444P16 to YUV420P10 for x265Model
  70. clip = core.resize.Bicubic(clip=clip, dither_type="none", format=vs.YUV420P10, range_s="limited")
  71. # set output frame rate to 50fps
  72. clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
  73. # Output
  74. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement