Advertisement
Guest User

Untitled

a guest
Dec 26th, 2023
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1. # Imports
  2. import vapoursynth as vs
  3. # getting Vapoursynth core
  4. import ctypes
  5. import site
  6. import sys
  7. import os
  8. core = vs.core
  9. # Import scripts folder
  10. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  11. sys.path.insert(0, os.path.abspath(scriptPath))
  12. # Adding torch dependencies to PATH
  13. path = site.getsitepackages()[0]+'/torch_dependencies/bin/'
  14. ctypes.windll.kernel32.SetDllDirectoryW(path)
  15. path = path.replace('\\', '/')
  16. os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
  17. # Loading Plugins
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libtemporalmedian.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ColorFilter/Grayworld/grayworld.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  22. # Import scripts
  23. import SpotLess
  24. import adjust
  25. # source: 'C:\Users\Selur\Desktop\Rick 1st Comm Raw LINES.mp4'
  26. # current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, fps: 29.97, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
  27. # Loading C:\Users\Selur\Desktop\Rick 1st Comm Raw LINES.mp4 using DGSource
  28. clip = core.dgdecodenv.DGSource("J:/tmp/mp4_2be3aaa4b8a73f3bdd16f9de0fb86fed_853323747.dgi")# 29.97 fps, scanorder: progressive
  29. # Setting detected color matrix (709).
  30. clip = core.std.SetFrameProps(clip, _Matrix=1)
  31. # Setting color transfer info (709)
  32. clip = core.std.SetFrameProps(clip, _Transfer=1)
  33. # Setting color primaries info (1)
  34. clip = core.std.SetFrameProps(clip, _Primaries=1)
  35. # Setting color range to TV (limited) range.
  36. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  37. # making sure frame rate is set to 29.97
  38. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  39. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  40. # Color Adjustment
  41. clip = adjust.Tweak(clip=clip, hue=0.00, sat=0.00, cont=1.00, coring=True)
  42. # adjusting color space from YUV420P8 to RGBH for vsDDColor
  43. clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="709", range_s="limited")
  44. # adding colors using DDColor
  45. from vsddcolor import ddcolor
  46. clip = ddcolor(clip=clip, model=1, input_size=256)
  47. # adjusting color space from RGBH to RGBS for vsGrayworld
  48. clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, range_s="limited")
  49. # Color Adjustment using Grayworld
  50. # convert to linear color space
  51. clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="709", range_s="limited")
  52. # limit to 0-1
  53. clip = core.std.Limiter(clip, 0.0, 1.0)
  54. clip = core.grwrld.grayworld(clip=clip)
  55. # undo conversion to linear color space
  56. clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="709", transfer_in_s="linear", range_s="limited")
  57. # adjusting color space from RGBS to YUV444P16 for vsSpotLess
  58. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="709", range_s="limited", dither_type="error_diffusion")
  59. # Spot removal using SpotLess
  60. clip = SpotLess.SpotLess(clip=clip, radT=2, pel=2)
  61. clip = core.std.CropRel(clip=clip, left=256, right=256, top=0, bottom=0)# cropping to 1408x1080
  62. # adjusting color space from YUV444P16 to RGBH for vsBasicVSRPPFilter
  63. clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="709", range_s="limited")
  64. # Quality enhancement using BasicVSR++
  65. from vsbasicvsrpp import basicvsrpp as BasicVSRPP
  66. clip = BasicVSRPP(clip=clip, model=6)
  67. # adjusting output color from: RGBH to YUV420P10 for NVEncModel
  68. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited", dither_type="error_diffusion")
  69. # set output frame rate to 29.97fps (progressive)
  70. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  71. # Output
  72. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement