Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.66 KB | None | 0 0
  1. # Imports
  2. import vapoursynth as vs
  3. # getting Vapoursynth core
  4. import ctypes
  5. import sys
  6. import os
  7. core = vs.core
  8. # Import scripts folder
  9. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  10. sys.path.insert(0, os.path.abspath(scriptPath))
  11. # Loading Support Files
  12. Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3-3.dll")
  13. Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  14. # loading plugins
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/EdgeFixer/EdgeFixer.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DebandFilter/Flash3kDeband/flash3kyuu_deband.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/TCanny.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/vcm.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")# vsQTGMC
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  28. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
  29. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
  30. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  31. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  32. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
  33. # Import scripts
  34. import mclean
  35. import mvsfunc
  36. import muvsfunc
  37. import havsfunc
  38. import validate
  39. # Source: 'C:\Users\Selur\Desktop\test2.mov'
  40. # Current color space: YUV444P12, bit depth: 12, resolution: 720x576, frame rate: 25fps, scanorder: top field first, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709
  41. # Loading C:\Users\Selur\Desktop\test2.mov using LibavSMASHSource
  42. clip = core.lsmas.LibavSMASHSource(source="C:/Users/Selur/Desktop/test2.mov")
  43. frame = clip.get_frame(0)
  44. # setting color matrix to 709.
  45. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
  46. # setting color transfer (vs.TRANSFER_BT709), if it is not set.
  47. if validate.transferIsInvalid(clip):
  48. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
  49. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  50. if validate.primariesIsInvalid(clip):
  51. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  52. # setting color range to TV (limited) range.
  53. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
  54. # making sure frame rate is set to 25fps
  55. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  56. # making sure the detected scan type is set (detected: top field first)
  57. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # tff
  58. # Deinterlacing using QTGMC
  59. clip = havsfunc.QTGMC(Input=clip, Preset="Fast", InputType=0, TFF=True, TR2=0, SourceMatch=0, Lossless=0, opencl=True) # new fps: 50
  60. # Making sure content is preceived as frame based
  61. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
  62. # converting to mod1 compatible format
  63. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
  64. clip = core.std.CropRel(clip=clip, left=11, right=11, top=0, bottom=2)# cropping to 698x574
  65. # denoising using mClean
  66. clip = mclean.mClean(clip=clip)
  67. # Fix bright and dark line artifacts near the border of an image using BalanceBorders
  68. clip = havsfunc.bbmod(c=clip,cLeft=68,cTop=0,cRight=0,cBottom=0)
  69. # Fix bright and dark line artifacts near the border of an image using EdgeFixer
  70. clip = core.edgefixer.Continuity(clip=clip,left=72)
  71. # Resizing using 10 - bicubic spline
  72. clip = core.fmtc.resample(clip=clip, kernel="spline16", w=720, h=592, interlaced=False, interlacedd=False) # resolution 720x592 before YUV444P16 after YUV444P16
  73. # adjusting output color from: YUV444P16 to YUV420P10 for NVEncModel
  74. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited", dither_type="error_diffusion")
  75. # set output frame rate to 50fps (progressive)
  76. clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
  77. # output
  78. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement