Guest User

Untitled

a guest
Jan 10th, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 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/libtemporalmedian.dll")
  12. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  13. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  14. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
  15. # Import scripts
  16. import SpotLess
  17. import havsfunc
  18. # source: 'G:\TEST01.mov'
  19. # current color space: YUV420P8, bit depth: 8, resolution: 1440x1080, fps: 25, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
  20. # Loading G:\TEST01.mov using LibavSMASHSource
  21. clip = core.lsmas.LibavSMASHSource(source="G:/TEST01.mov")
  22. frame = clip.get_frame(0)
  23. # Setting detected color matrix (709).
  24. clip = core.std.SetFrameProps(clip, _Matrix=1)
  25. # Setting color transfer (to 709), if it is not set.
  26. if '_Transfer' not in frame.props or not frame.props['_Transfer']:
  27. clip = core.std.SetFrameProps(clip, _Transfer=1)
  28. # Setting color primaries info (to 1), if it is not set.
  29. if '_Primaries' not in frame.props or not frame.props['_Primaries']:
  30. clip = core.std.SetFrameProps(clip, _Primaries=1)
  31. # Setting color range to TV (limited) range.
  32. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  33. # making sure frame rate is set to 25
  34. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  35. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  36. clip = core.std.CropRel(clip=clip, left=20, right=20, top=0, bottom=20)# cropping to 1400x1060
  37. # Resizing using 10 - bicubic spline
  38. clip = core.fmtc.resample(clip=clip, kernel="spline16", w=360, h=274, interlaced=False, interlacedd=False) # resolution 360x274 before YUV420P8 after YUV420P16
  39. # Fix bright and dark line artifacts near the border of an image using BalanceBorders
  40. clip = havsfunc.bbmod(c=clip,cLeft=0,cTop=0,cRight=8,cBottom=0)
  41. # Spot removal using SpotLess
  42. clip = SpotLess.SpotLess(clip=clip, radT=3, pel=1)
  43. clip = core.std.AddBorders(clip=clip, left=0, right=0, top=2, bottom=4) # add borders to archive mod 8 (vsBasicVSRPPFilter) - 360x280
  44. # adjusting color space from YUV420P16 to RGBH for vsBasicVSRPPFilter
  45. clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="709", range_s="limited")
  46. # Quality enhancement using BasicVSR++
  47. from vsbasicvsrpp import basicvsrpp as BasicVSRPP
  48. clip = BasicVSRPP(clip=clip, model=6, length=100)
  49. clip = core.std.CropRel(clip=clip, left=0, right=0, top=2, bottom=4) # removing borders (vsBasicVSRPPFilter) - 360x274
  50. # adjusting output color from: RGBH to YUV420P10 for NVEncModel
  51. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited", dither_type="error_diffusion")
  52. # set output frame rate to 25fps (progressive)
  53. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  54. # Output
  55. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment