Guest User

Untitled

a guest
Aug 21st, 2024
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 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/DerainbowFilter/SmoothUV/libsmoothuv.dll")
  12. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeCrawlFilter/DotKill/DotKill.dll")
  13. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
  14. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  15. # Import scripts
  16. import RainbowSmooth
  17. import validate
  18. # Source: 'C:\Users\Selur\Desktop\Harvey Birdman.mpg'
  19. # Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: telecine, yuv luminance scale: limited, matrix: 470bg
  20. # Loading C:\Users\Selur\Desktop\Harvey Birdman.mpg using DGSource
  21. clip = core.dgdecodenv.DGSource("J:/tmp/mpg_1aa67b072e9949eb8cfc98ec74963621_853323747.dgi",fieldop=0)# 29.97 fps, scanorder: telecine
  22. frame = clip.get_frame(0)
  23. # setting color matrix to 470bg.
  24. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
  25. # setting color transfer (vs.TRANSFER_BT601), if it is not set.
  26. if validate.transferIsInvalid(clip):
  27. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
  28. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  29. if validate.primariesIsInvalid(clip):
  30. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  31. # setting color range to TV (limited) range.
  32. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
  33. # making sure frame rate is set to 29.97fps
  34. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  35. # making sure the detected scan type is set (detected: telecine)
  36. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # tff
  37. # Deinterlacing using TIVTC
  38. clip = core.tivtc.TFM(clip=clip)
  39. clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976
  40. # Making sure content is preceived as frame based
  41. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
  42. clip = core.dotkill.DotKillS(clip=clip)
  43. # rainbow removal using RainbowSmooth
  44. clip = RainbowSmooth.RainbowSmooth(clip=clip)
  45. # adjusting color space from YUV420P8 to RGBH for vsBasicVSRPPFilter
  46. clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="limited")
  47. # Quality enhancement using BasicVSR++
  48. from vsbasicvsrpp import basicvsrpp as BasicVSRPP
  49. clip = BasicVSRPP(clip=clip, model=4)
  50. # adjusting output color from: RGBH to YUV420P10 for NVEncModel
  51. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
  52. # set output frame rate to 23.976fps (progressive)
  53. clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
  54. # output
  55. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment