Advertisement
Guest User

Untitled

a guest
Sep 9th, 2022
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.20 KB | None | 0 0
  1. # Imports
  2. import vapoursynth as vs
  3. import os
  4. import ctypes
  5. # Loading Support Files
  6. Dllref = ctypes.windll.LoadLibrary("i:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  7. import sys
  8. # getting Vapoursynth core
  9. core = vs.core
  10. # Import scripts folder
  11. scriptPath = 'i:/Hybrid/64bit/vsscripts'
  12. sys.path.insert(0, os.path.abspath(scriptPath))
  13. # Loading Plugins
  14. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
  15. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/HQDN3D/libhqdn3d.dll")
  16. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
  17. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  18. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  19. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  20. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  21. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")
  22. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  23. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  24. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  25. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  26. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  27. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/d2vSource/d2vsource.dll")
  28. # Import scripts
  29. import rescued
  30. import havsfunc
  31. # source: 'C:\Users\Selur\Desktop\VTS_01_1.demuxed.m2v'
  32. # current color space: YUV420P8, bit depth: 8, resolution: 704x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: telecine
  33. # Loading C:\Users\Selur\Desktop\VTS_01_1.demuxed.m2v using D2VSource
  34. clip = core.d2v.Source(input="E:/Temp/m2v_83dd13dfe4f9aeb8ccbb12702dbe2152_853323747.d2v")
  35. # Setting color matrix to 470bg.
  36. clip = core.std.SetFrameProps(clip, _Matrix=5)
  37. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  38. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
  39. # Setting color range to TV (limited) range.
  40. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  41. # making sure frame rate is set to 29.970
  42. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  43. clip2clip = clip
  44. clip2clip = havsfunc.QTGMC(Input=clip2clip, Preset="fast", opencl=True, TFF=True,FPSDivisor=2)
  45. # Deinterlacing using TIVTC
  46. clip = core.tivtc.TFM(clip=clip, clip2=clip2clip)
  47. clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976
  48. # make sure content is preceived as frame based
  49. clip = core.std.SetFieldBased(clip, 0)
  50. clip = havsfunc.Vinverse(clp=clip)
  51. # cropping the video to 664x268
  52. clip = core.std.CropRel(clip=clip, left=24, right=16, top=106, bottom=106)
  53. clip = core.std.AddBorders(clip=clip, left=0, right=0, top=0, bottom=4) # add borders to archive mod 8 (vsBasicVSRPPFilter) - 664x272
  54. # adjusting color space from YUV420P8 to RGBS for vsBasicVSRPPFilter
  55. clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
  56. # Quality enhancement using BasicVSR++
  57. from vsbasicvsrpp import BasicVSRPP
  58. clip = BasicVSRPP(clip=clip, model=3, fp16=True)
  59. clip = core.std.CropRel(clip=clip, left=0, right=0, top=0, bottom=4) # removing borders (vsBasicVSRPPFilter) - 664x268
  60. # adjusting color space from RGBS to YUV444P8 for vsTemporalDegrain
  61. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="limited", dither_type="none")
  62. # removing grain using TemporalDegrain
  63. clip = rescued.TemporalDegrain(inpClip=clip)
  64. # Resizing using 10 - bicubic spline
  65. clip = core.fmtc.resample(clip=clip, kernel="spline16", w=720, h=328, interlaced=False, interlacedd=False) # resolution 720x328
  66. # adjusting output color from: YUV444P16 to YUV420P10 for x265Model
  67. clip = core.resize.Bicubic(clip=clip, dither_type="none", format=vs.YUV420P10, range_s="limited")
  68. # set output frame rate to 23.976fps
  69. clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
  70. # Output
  71. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement