Advertisement
Guest User

Untitled

a guest
Jan 28th, 2023
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 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/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  15. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
  16. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  17. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  18. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
  19. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  20. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
  21. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  22. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  23. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  24. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  25. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  26. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  27. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  28. # Import scripts
  29. import mvsfunc
  30. import havsfunc
  31. # source: 'C:\Users\Selur\Desktop\12_clip.mkv'
  32. # current color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
  33. # Loading C:\Users\Selur\Desktop\12_clip.mkv using DGSource
  34. clip = core.dgdecodenv.DGSource("J:/tmp/mkv_d7b47a921725e8cb59f6b938f4efa5a6_853323747.dgi",fieldop=0)# 25 fps, scanorder: top field first
  35. # Setting detected color matrix (470bg).
  36. clip = core.std.SetFrameProps(clip, _Matrix=5)
  37. # Setting color transfer info, when it is not set
  38. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
  39. # Setting color primaries info, when it is not set
  40. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
  41. # Setting color range to TV (limited) range.
  42. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  43. # making sure frame rate is set to 25
  44. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  45. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2)
  46. # setting field order to what QTGMC should assume (top field first)
  47. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2)
  48. # Deinterlacing using QTGMC
  49. clip = havsfunc.QTGMC(Input=clip, Preset="Slow", TFF=True, opencl=True) # new fps: 50
  50. # make sure content is preceived as frame based
  51. clip = core.std.SetFieldBased(clip, 0)
  52. # cropping the video to 714x572
  53. clip = core.std.CropRel(clip=clip, left=4, right=2, top=2, bottom=2)
  54. clip = core.std.AddBorders(clip=clip, left=0, right=2, top=0, bottom=0) # add borders to archive mod 4 (vsQTGMCFilter) - 716x572
  55. # Denoising using QTGMC
  56. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", InputType=1, TR2=1, SourceMatch=0, Lossless=0, opencl=True)
  57. clip = core.std.CropRel(clip=clip, left=0, right=2, top=0, bottom=0) # removing borders (vsQTGMCFilter) - 714x572
  58. # applying dehalo using YAHR
  59. clip = havsfunc.YAHR(clip)
  60. # line darkening using Toon
  61. clip = havsfunc.Toon(input=clip,str=2.00,blur=4)
  62. clip = core.std.AddBorders(clip=clip, left=0, right=6, top=0, bottom=4) # add borders to archive mod 8 (vsBasicVSRPPFilter) - 720x576
  63. # adjusting color space from YUV420P8 to RGBS for vsBasicVSRPPFilter
  64. clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
  65. # Quality enhancement using BasicVSR++
  66. from vsbasicvsrpp import BasicVSRPP
  67. clip = BasicVSRPP(clip=clip, model=3, interval=1, fp16=True)
  68. clip = core.std.CropRel(clip=clip, left=0, right=6, top=0, bottom=4) # removing borders (vsBasicVSRPPFilter) - 714x572
  69. # Resizing using 10 - bicubic spline
  70. clip = core.fmtc.resample(clip=clip, kernel="spline16", w=1024, h=770, interlaced=False, interlacedd=False) # resolution 1024x770
  71. # adjusting output color from: RGBS to YUV420P10 for NVEncModel
  72. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
  73. # set output frame rate to 50fps
  74. clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
  75. # Output
  76. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement