Guest User

dehalo Vapoursynth

a guest
Jul 21st, 2026
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. # Imports
  2. import sys
  3. import os
  4. import vapoursynth as vs
  5. # using Vapoursynth R78
  6. # getting Vapoursynth core
  7. core = vs.core
  8. # Limit frame cache to 48449MB
  9. core.max_cache_size = 48449
  10. # Import scripts folder
  11. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  12. sys.path.insert(0, os.path.abspath(scriptPath))
  13. # loading plugins
  14. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/zsmooth/zsmooth.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
  21. # defining beforeEnd-function - START
  22. def beforeEnd(clip):
  23. mod = clip
  24. for _ in range(2):
  25. mod = core.std.Expr(mod,expr=["x 180 > x 0.80 * 35 + x ?", "", ""] )
  26. edges = core.std.Sobel(clip.std.ShufflePlanes(0, vs.GRAY))
  27. mask = edges
  28. for _ in range(3):
  29. mask = core.std.Maximum(mask)
  30. mask = core.std.BoxBlur(mask, hradius=3, vradius=3)
  31. clip = core.std.MaskedMerge(clip, mod, mask)
  32. return [clip]
  33. # defining beforeEnd-function - END
  34.  
  35. # Import scripts
  36. import sharpen
  37. import dehalo
  38. import validate
  39. # Source: 'G:\clips\halo\heavyhaloremovalogsample.ts'
  40. # clip current meta; color space: YUV420P8, bit depth: 8, resolution: 1440x1080, fps: 23.976, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true (Source)
  41. # Loading 'G:\clips\halo\heavyhaloremovalogsample.ts' using DGSource
  42. clip = core.dgdecodenv.DGSource("J:/tmp/ts_050a3135ec1bd5ee205d5bb3d0ce01fa_853323747.dgi") # 23.976 fps, scanorder: progressive
  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_BT709), if it is not set.
  50. if validate.primariesIsInvalid(clip):
  51. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
  52. # setting color range to TV (limited) range.
  53. prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
  54. clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})
  55. # making sure frame rate is set to 23.976fps
  56. clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
  57. # making sure the detected scan type is set (detected: progressive)
  58. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  59.  
  60. # Field matching using TFM
  61. clip = core.tivtc.TFM(clip)
  62. # applying dehalo using DeHalo_alpha
  63. clip = dehalo.DeHalo_alpha(clip, rx=4.00, ry=4.00, darkstr=0.00)
  64. # applying dehalo using YAHR
  65. for i in range(0,4):
  66. clip = dehalo.YAHR(clip, depth=64)
  67. [clip] = beforeEnd(clip)
  68. # clip current meta; color space: YUV420P8, bit depth: 8, resolution: 1440x1080, fps: 23.976, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true
  69. # adjusting output color from YUV420P8 to YUV420P10 for NVEncModel
  70. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10)
  71. # set output frame rate to 23.976fps (progressive)
  72. clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
  73. # output
  74. clip.set_output()
  75. # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 1440x1080, fps: 23.976, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
  76. # script was created by Hybrid 2026.07.20.1
Advertisement
Add Comment
Please, Sign In to add comment