Advertisement
Guest User

Untitled

a guest
Nov 12th, 2022
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 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/CAS/CAS.dll")
  15. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  16. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DebandFilter/Flash3kDeband/flash3kyuu_deband.dll")
  17. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/DCTFilter.dll")
  18. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeblockFilter/Deblock/Deblock.dll")
  19. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  20. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  21. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
  22. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  23. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")
  24. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  25. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  26. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  27. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  28. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  29. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  30. core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
  31. # Import scripts
  32. import havsfunc
  33. # source: 'C:\Users\Selur\Desktop\Donna-Summer-2-tff.mp4'
  34. # current color space: YUV422P10, bit depth: 10, resolution: 760x488, fps: 29.97, color matrix: 709, yuv luminance scale: limited, scanorder: top field first
  35. # Loading C:\Users\Selur\Desktop\Donna-Summer-2-tff.mp4 using LibavSMASHSource
  36. clip = core.lsmas.LibavSMASHSource(source="C:/Users/Selur/Desktop/Donna-Summer-2-tff.mp4")
  37. # Setting color matrix to 709.
  38. clip = core.std.SetFrameProps(clip, _Matrix=1)
  39. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=1)
  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 29.970
  44. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  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="Fast", TFF=True, opencl=True) # new fps: 59.94
  50. # make sure content is preceived as frame based
  51. clip = core.std.SetFieldBased(clip, 0)
  52. # applying deblocking using DeBlock QED
  53. clip = havsfunc.Deblock_QED(clip, aOff1=2, aOff2=3, bOff1=2, bOff2=3, uv=1)
  54. # cropping the video to 742x482
  55. clip = core.std.CropRel(clip=clip, left=10, right=8, top=4, bottom=2)
  56. ## Starting applying 'EdgeMask (Prewitt)' masked filtering for vsDFTTest
  57. clipMask = clip
  58. clipMask = core.std.ShufflePlanes(clipMask, 0, vs.GRAY)
  59. clipMask = core.std.Prewitt(clip=clipMask)
  60. clipMask = core.std.InvertMask(clipMask)
  61. clipFiltered = clip
  62. # denoising using DFTTest
  63. clipFiltered = core.dfttest.DFTTest(clip=clipFiltered, sigma=50.00, sigma2=30.00)
  64. clip = core.std.MaskedMerge(clip, clipFiltered, clipMask)
  65. ## Finished applying 'Edgemask (Prewitt)' masked filtering for vsDFTTest
  66. # debanding using f3kdb
  67. clip = core.f3kdb.Deband(clip, keep_tv_range=True, output_depth=16)
  68. # sharpening using AWarpSharp2
  69. clip = core.warp.AWarpSharp2(clip=clip, thresh=255, blur=2, depth=8, planes=[1,2])
  70. # contrast sharpening using CAS
  71. clip = core.cas.CAS(clip=clip, sharpness=0.600)
  72. # Resizing using 10 - bicubic spline
  73. clip = core.fmtc.resample(clip=clip, kernel="spline16", w=884, h=488, interlaced=False, interlacedd=False) # resolution 884x488
  74. # adjusting output color from: YUV422P16 to YUV422P10 for x265Model
  75. clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P10, range_s="limited", dither_type="none")
  76. # set output frame rate to 59.94fps
  77. clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
  78. # Output
  79. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement