Guest User

Untitled

a guest
Feb 16th, 2024
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 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/FrameFilter/Interframe/svpflow2_vs64.dll")
  12. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/Interframe/svpflow1_vs64.dll")
  13. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libsangnom.dll")
  14. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI2.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  20. # Import scripts
  21. import havsfunc
  22. import mvsfunc
  23. # source: 'C:\Users\Selur\Desktop\RAW.mkv'
  24. # current color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg, transfer: bt.601, primaries: bt.601 ntsc
  25. # Loading C:\Users\Selur\Desktop\RAW.mkv using DGSource
  26. clip = core.dgdecodenv.DGSource("J:/tmp/mkv_7f129c2329c33dd2180d3204f1aef078_853323747.dgi",fieldop=0)# 29.97 fps, scanorder: top field first
  27. frame = clip.get_frame(0)
  28. # Setting detected color matrix (470bg).
  29. clip = core.std.SetFrameProps(clip, _Matrix=5)
  30. # Setting color transfer (601), if it is not set.
  31. if '_Transfer' not in frame.props or not frame.props['_Transfer']:
  32. clip = core.std.SetFrameProps(clip, _Transfer=5)
  33. # Setting color primaries info (to 470), if it is not set.
  34. if '_Primaries' not in frame.props or not frame.props['_Primaries']:
  35. clip = core.std.SetFrameProps(clip, _Primaries=5)
  36. # Setting color range to TV (limited) range.
  37. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  38. # making sure frame rate is set to 29.97
  39. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  40. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2) # tff
  41. clip = core.tivtc.TFM(clip=clip)
  42. # Making sure content is preceived as frame based
  43. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  44. # applying anti aliasing using santiag
  45. clip = havsfunc.santiag(c=clip, type="sangnom")
  46. # adjusting color space from YUV420P8 to RGBH for vsBasicVSRPPFilter
  47. clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="limited")
  48. # Quality enhancement using BasicVSR++
  49. from vsbasicvsrpp import basicvsrpp as BasicVSRPP
  50. clip = BasicVSRPP(clip=clip, model=4)
  51. # adjusting color space from RGBH to YUV420P8 for vsFillDuplicateFrames
  52. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
  53. from FillDuplicateFrames import FillDuplicateFrames
  54. fdf = FillDuplicateFrames(clip=clip, method="SVP", thresh=0.010000)
  55. clip = fdf.out
  56. # no resizing since resolution is already archived
  57. # adjusting output color from: YUV420P8 to YUV420P10 for NVEncModel
  58. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
  59. # set output frame rate to 29.97fps (progressive)
  60. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  61. # Output
  62. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment