Guest User

Untitled

a guest
Apr 5th, 2025
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 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/libfftw3f-3.dll")
  13. # loading plugins
  14. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/RemoveDirt/RemoveDirtVS.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/HQDN3D/libhqdn3d.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/TTempSmooth/TTempSmooth.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/DCTFilter.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeblockFilter/Deblock/Deblock.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
  27. # Import scripts
  28. import killerspots
  29. import denoise
  30. import artifacts
  31. import SpotLess
  32. import validate
  33. # Source: 'G:\clips\lost cause\Test_video.mkv'
  34. # Current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, frame rate: 24fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709, format: AVC
  35. # Loading G:\clips\lost cause\Test_video.mkv using DGSource
  36. clip = core.dgdecodenv.DGSource("J:/tmp/mkv_b53017f2e08a0d6a79ed0fcc8c9aaeb9_853323747.dgi")# 24 fps, scanorder: progressive
  37. frame = clip.get_frame(0)
  38. # setting color matrix to 709.
  39. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
  40. # setting color transfer (vs.TRANSFER_BT709), if it is not set.
  41. if validate.transferIsInvalid(clip):
  42. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
  43. # setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
  44. if validate.primariesIsInvalid(clip):
  45. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
  46. # setting color range to TV (limited) range.
  47. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
  48. # making sure frame rate is set to 24fps
  49. clip = core.std.AssumeFPS(clip=clip, fpsnum=24, fpsden=1)
  50. # making sure the detected scan type is set (detected: progressive)
  51. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
  52. # contrast sharpening using CAS
  53. clip = core.cas.CAS(clip=clip, sharpness=1.000)
  54. # Spot removal using SpotLess
  55. clip = SpotLess.SpotLess(clip=clip, radT=3, pel=2, smoother="zsmooth")
  56. for i in range(5):
  57. clip = artifacts.DeSpot(o=clip)
  58. clip = core.std.Crop(clip=clip, left=174, right=174, top=0, bottom=0)# cropping to 1572x1080
  59. # denoising using MCTemporalDenoise
  60. clip = denoise.MCTemporalDenoise(i=clip, settings="very high", thSAD=600, thSAD2=600, thSCD1=600, thSCD2=130, truemotion=True, MVglobal=True, pel=4, pelsearch=2, search=2, searchparam=2, MVsharp=0, DCT=1, ncpu=10)
  61. # denoising using HQDN3D
  62. clip = core.hqdn3d.Hqdn3d(clip=clip, lum_spac=0.00, chrom_spac=50.00)
  63. clip = core.std.AddBorders(clip=clip, left=2, right=2, top=0, bottom=0) # add borders to archive mod 8 (vsKillerSpots) - 1576x1080
  64. clip = killerspots.KillerSpots(clip=clip, advanced=False)
  65. clip = core.std.Crop(clip=clip, left=2, right=2, top=0, bottom=0) # removing borders (vsKillerSpots) - 1572x1080
  66. # adjusting output color from: YUV420P8 to YUV420P10 for NVEncModel
  67. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
  68. # set output frame rate to 24fps (progressive)
  69. clip = core.std.AssumeFPS(clip=clip, fpsnum=24, fpsden=1)
  70. # output
  71. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment