Advertisement
Guest User

Untitled

a guest
Jan 31st, 2025
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 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/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/DePan.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  22. # Import scripts
  23. import mvsfunc
  24. import muvsfunc
  25. import lostfunc
  26. import havsfunc
  27. import validate
  28. # Source: 'C:\Users\Selur\Desktop\dotcraw_test.mkv'
  29. # Current color space: YUV420P8, bit depth: 8, resolution: 640x480, frame rate: 29.97fps, scanorder: progressive, yuv luminance scale: limited, matrix: 470bg, transfer: bt.601, primaries: bt.601 ntsc, format: AVC
  30. # Loading C:\Users\Selur\Desktop\dotcraw_test.mkv using DGSource
  31. clip = core.dgdecodenv.DGSource("J:/tmp/mkv_6a9fe856471799b1667862f364620b82_853323747.dgi")# 29.97 fps, scanorder: progressive
  32. frame = clip.get_frame(0)
  33. # setting color matrix to 470bg.
  34. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
  35. # setting color transfer (vs.TRANSFER_BT601), if it is not set.
  36. if validate.transferIsInvalid(clip):
  37. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
  38. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  39. if validate.primariesIsInvalid(clip):
  40. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  41. # setting color range to TV (limited) range.
  42. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
  43. # making sure frame rate is set to 29.97fps
  44. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  45. # making sure the detected scan type is set (detected: progressive)
  46. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
  47. # anti decrawling using LUTDeCrawl
  48. clip = havsfunc.LUTDeCrawl(input=clip)
  49. # applying dehalo using DeHalo_alpha
  50. clip = havsfunc.DeHalo_alpha(clip)
  51. # stabilizing using Stab
  52. clip = lostfunc.Stab(clp=clip,range=3,mirror=0)
  53. clip = core.std.Crop(clip=clip, left=2, right=0, top=2, bottom=0)# cropping to 638x478
  54. clip = core.std.AddBorders(clip=clip, left=0, right=2, top=0, bottom=2) # add borders to archive mod 8 (vsBasicVSRPPFilter) - 640x480
  55. # adjusting color space from YUV420P8 to RGBH for vsBasicVSRPPFilter
  56. clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="limited")
  57. # Quality enhancement using BasicVSR++
  58. from vsbasicvsrpp import basicvsrpp as BasicVSRPP
  59. clip = BasicVSRPP(clip=clip, model=4)
  60. clip = core.std.Crop(clip=clip, left=0, right=2, top=0, bottom=2) # removing borders (vsBasicVSRPPFilter) - 638x478
  61. # adjusting color space from RGBH to YUV444P16 for vssRestore
  62. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited")
  63. # adjusting frame count and rate with sRestore
  64. clip = muvsfunc.srestore(source=clip, frate=23.9760)
  65. # sharpening using AWarpSharp2
  66. clip = core.warp.AWarpSharp2(clip=clip, blur=2, depth=32, chroma=True, planes=[1,2])
  67. # applying anti aliasing using santiag
  68. clip = havsfunc.santiag(c=clip, nns=2, qual=2, pscrn=2, opencl=True)
  69. # adjusting output color from: YUV444P16 to YUV420P10 for NVEncModel
  70. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited", dither_type="error_diffusion")
  71. # set output frame rate to 23.976fps (progressive)
  72. clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
  73. # output
  74. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement