Advertisement
Guest User

Untitled

a guest
Jun 1st, 2024
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. # Imports
  2. import vapoursynth as vs
  3. # getting Vapoursynth core
  4. import sys
  5. import os
  6. core = vs.core
  7. # Import scripts folder
  8. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  9. sys.path.insert(0, os.path.abspath(scriptPath))
  10. # loading plugins
  11. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  12. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  13. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
  14. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  18. # Import scripts
  19. import havsfunc
  20. import validate
  21. # Source: 'C:\Users\Selur\Desktop\wetransfer_lut-saturation-clip-1-mkv_2024-05-31_2022\P1070281.MP4'
  22. # Current color space: YUV420P8, bit depth: 8, resolution: 3840x2160, frame rate: 25fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709
  23. # Loading C:\Users\Selur\Desktop\wetransfer_lut-saturation-clip-1-mkv_2024-05-31_2022\P1070281.MP4 using DGSource
  24. clip = core.dgdecodenv.DGSource("J:/tmp/mp4_dc61bc143d24b5e37cfa4aa9c0fb0375_853323747.dgi")# 25 fps, scanorder: progressive
  25. frame = clip.get_frame(0)
  26. # Setting detected color matrix (709).
  27. clip = core.std.SetFrameProps(clip=clip, _Matrix=1)
  28. # setting color transfer (709), if it is not set.
  29. if validate.transferIsInvalid(clip):
  30. clip = core.std.SetFrameProps(clip=clip, _Transfer=1)
  31. # setting color primaries info (to 2020), if it is not set.
  32. if validate.primariesIsInvalid(clip):
  33. clip = core.std.SetFrameProps(clip=clip, _Primaries=9)
  34. # setting color range to TV (limited) range.
  35. clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
  36. # making sure frame rate is set to 25fps
  37. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  38. # making sure the detected scan type is set (detected: progressive)
  39. clip = core.std.SetFrameProps(clip=clip, _FieldBased=0)# progressive
  40. # denoising using KNLMeansCL
  41. clip = core.knlm.KNLMeansCL(clip=clip, d=0, a=4, s=8, channels="Y")
  42. # applying debanding using vs-placebo.Deband
  43. clip = core.placebo.Deband(clip=clip, grain=0.00, planes=1)
  44. # adjusting color space from YUV420P8 to YUV444P16 for vsGLSLCAS
  45. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
  46. with open("F:/Hybrid/64bit/vsfilters/GLSL/parameterized/CAS.glsl") as glslf:
  47. glsl = glslf.read()
  48. glsl = glsl.replace('#define SHARPENING 0.0', '#define SHARPENING 0.5')
  49. glsl = glsl.replace('#define CAS_BETTER_DIAGONALS 1', '#define CAS_BETTER_DIAGONALS 1')
  50. glsl = glsl.replace('#define CAS_GO_SLOWER 0', '#define CAS_GO_SLOWER 1')
  51. glsl = glsl.replace('#define SOURCE_TRC 0', '#define SOURCE_TRC 0')
  52. glsl = glsl.replace('#define TARGET_TRC 0', '#define TARGET_TRC 0')
  53. clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
  54. # applying dehalo using YAHR
  55. clip = havsfunc.YAHR(clip, depth=16)
  56. # adjusting output color from: YUV444P16 to YUV420P10 for NVEncModel
  57. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited", dither_type="error_diffusion")
  58. # set output frame rate to 25fps (progressive)
  59. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  60. # output
  61. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement