Guest User

Untitled

a guest
Apr 8th, 2023
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.14 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/DenoiseFilter/TTempSmooth/TTempSmooth.dll")
  15. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  16. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/DCTFilter.dll")
  17. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeblockFilter/Deblock/Deblock.dll")
  18. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
  19. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeblockFilter/DeblockPP7/DeblockPP7.dll")
  20. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  21. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  22. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  23. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
  24. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
  25. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  26. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  27. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  28. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  29. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  30. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  31. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  32. # Import scripts
  33. import lostfunc
  34. import havsfunc
  35. # source: 'C:\Users\Selur\Desktop\mmp_intro_sample.m2v'
  36. # current color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
  37. # Loading C:\Users\Selur\Desktop\mmp_intro_sample.m2v using DGSource
  38. clip = core.dgdecodenv.DGSource("J:/tmp/m2v_9696bbfe2283c3d91c02a2f76e706d3e_853323747.dgi",fieldop=0)# 25 fps, scanorder: top field first
  39. # Setting detected color matrix (470bg).
  40. clip = core.std.SetFrameProps(clip, _Matrix=5)
  41. # Setting color transfer info (470bg), when it is not set
  42. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  43. # Setting color primaries info (BT.601 PAL), when it is not set
  44. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
  45. # Setting color range to TV (limited) range.
  46. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  47. # making sure frame rate is set to 25
  48. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  49. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2) # tff
  50. # cutting from frame 0 to 1599 - WARNING: This might cause synch issues
  51. clip = core.std.Trim(clip=clip, first=0, last=1599)
  52. # Deinterlacing using QTGMC
  53. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True, opencl=True) # new fps: 50
  54. # Making sure content is preceived as frame based
  55. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  56. clip = lostfunc.DeSpot(o=clip)
  57. # applying deblocking using DeblockPP7
  58. clip = core.pp7.DeblockPP7(clip=clip, qp=12.00)
  59. # adjusting color space from YUV420P8 to YUV444P16 for vsGLSLDarken
  60. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited", dither_type="error_diffusion")
  61. # Using Anime4k Darken GLSL filter for line darkening
  62. with open("i:/Hybrid/64bit/vsfilters/GLSL/parameterized/Anime4K_Darken_HQ.glsl") as glslf:
  63. glsl = glslf.read()
  64. glsl = glsl.replace('#define STRENGTH 1.5', '#define STRENGTH 2.5')
  65. clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
  66. # adjusting frame count and rate with sRestore
  67. clip = havsfunc.srestore(source=clip, frate=18.0000, omode=6, speed=-25, thresh=16, mode=2)
  68. # denoising using MCTemporalDenoise
  69. clip = havsfunc.MCTemporalDenoise(i=clip, settings="very high", ncpu=1)
  70. with open("i:/Hybrid/64bit/vsfilters/GLSL/parameterized/CAS.glsl") as glslf:
  71. glsl = glslf.read()
  72. glsl = glsl.replace('#define SHARPENING 0.0', '#define SHARPENING 0.65')
  73. glsl = glsl.replace('#define CAS_BETTER_DIAGONALS 1', '#define CAS_BETTER_DIAGONALS 1')
  74. glsl = glsl.replace('#define CAS_GO_SLOWER 0', '#define CAS_GO_SLOWER 1')
  75. glsl = glsl.replace('#define SOURCE_TRC 0', '#define SOURCE_TRC 0')
  76. glsl = glsl.replace('#define TARGET_TRC 0', '#define TARGET_TRC 0')
  77. clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
  78. # adjusting output color from: YUV444P16 to YUV420P10 for NVEncModel
  79. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
  80. # set output frame rate to 18fps (progressive)
  81. clip = core.std.AssumeFPS(clip=clip, fpsnum=18, fpsden=1)
  82. # Output
  83. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment