Advertisement
Guest User

Untitled

a guest
Jul 7th, 2024
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 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/Support/libsangnom.dll")
  12. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI2.dll")
  13. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
  14. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  19. # Import scripts
  20. import mvsfunc
  21. import havsfunc
  22. import masked
  23. import validate
  24. # Source: 'C:\Users\Selur\Desktop\RollerCoaster.mp4'
  25. # Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: progressive, yuv luminance scale: limited, matrix: 470bg
  26. # Loading C:\Users\Selur\Desktop\RollerCoaster.mp4 using DGSource
  27. clip = core.dgdecodenv.DGSource("J:/tmp/mp4_a19ebf792683f64d862a46eaf9f3d146_853323747.dgi")# 29.97 fps, scanorder: progressive
  28. frame = clip.get_frame(0)
  29. # Setting detected color matrix (470bg).
  30. clip = core.std.SetFrameProps(clip=clip, _Matrix=5)
  31. # setting color transfer (170), if it is not set.
  32. if validate.transferIsInvalid(clip):
  33. clip = core.std.SetFrameProps(clip=clip, _Transfer=6)
  34. # setting color primaries info (to 470), if it is not set.
  35. if validate.primariesIsInvalid(clip):
  36. clip = core.std.SetFrameProps(clip=clip, _Primaries=5)
  37. # setting color range to TV (limited) range.
  38. clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
  39. # making sure frame rate is set to 29.97fps
  40. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  41. # making sure the detected scan type is set (detected: progressive)
  42. clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
  43. ## Starting applying 'limit' masked filtering for vsAWarpSharp2
  44. clipMask = clip
  45. clipMask = core.resize.Bicubic(clip=clipMask, format=vs.GRAY8, range_s="limited")
  46. clipMask = core.std.BinarizeMask(clipMask, 160)
  47. clipFiltered = clip
  48. # sharpening using AWarpSharp2
  49. clipFiltered = core.warp.AWarpSharp2(clip=clipFiltered, blur=2, depth=42, planes=[0])
  50. clipMask = core.resize.Bicubic(clip=clipMask, format=vs.YUV420P8, range_s="limited")
  51. clip = core.std.MaskedMerge(clip, clipFiltered, clipMask) # LimitMask
  52. ## Finished applying 'LimitMask' masked filtering for vsAWarpSharp2
  53. # applying dehalo using DeHalo_alpha
  54. clip = havsfunc.DeHalo_alpha(clip, rx=2.50, ry=2.50, darkstr=1.20, brightstr=1.20)
  55. # applying anti aliasing using santiag
  56. clip = havsfunc.santiag(c=clip, nns=2, qual=2, pscrn=2, opencl=True)
  57. from vsdpir import dpir as DPIR
  58. # adjusting color space from YUV420P8 to RGBH for vsDPIRDenoise
  59. clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="limited")
  60. # denoising using DPIRDenoise
  61. clip = DPIR(clip=clip, strength=5.000, task="denoise", device_index=0, num_streams=3, trt=True, trt_cache_dir="J:/tmp")
  62. # no resizing since resolution is already archived
  63. # adjusting output color from: RGBH to YUV420P10 for NVEncModel
  64. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
  65. # set output frame rate to 29.97fps (progressive)
  66. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  67. # output
  68. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement