Guest User

Untitled

a guest
Apr 7th, 2026
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1. # Imports
  2. import sys
  3. import os
  4. import vapoursynth as vs
  5. # getting Vapoursynth core
  6. core = vs.core
  7. # Limit frame cache to 48449MB
  8. core.max_cache_size = 48449
  9. # Import scripts folder
  10. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  11. sys.path.insert(0, os.path.abspath(scriptPath))
  12. # loading plugins
  13. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll")
  14. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
  17. # Import scripts
  18. import validate
  19. # Source: 'C:\Users\Selur\Desktop\OPBox2.mkv'
  20. # Current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, frame rate: 29.97fps, scanorder: telecine, yuv luminance scale: limited, matrix: 709, format: AVC
  21. # Loading 'C:\Users\Selur\Desktop\OPBox2.mkv' using DGSource
  22. clip = core.dgdecodenv.DGSource("J:/tmp/mkv_0604cae322f9fbe00040844b856ac3a4_853323747.dgi",fieldop=0) # 29.97 fps, scanorder: telecine
  23. frame = clip.get_frame(0)
  24. # setting color matrix to 709.
  25. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
  26. # setting color transfer (vs.TRANSFER_BT709), if it is not set.
  27. if validate.transferIsInvalid(clip):
  28. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
  29. # setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
  30. if validate.primariesIsInvalid(clip):
  31. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
  32. # setting color range to TV (limited) range.
  33. prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
  34. clip = core.std.SetFrameProps(clip=clip, prop_name=vs.RANGE_LIMITED)
  35. # making sure frame rate is set to 29.97fps
  36. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  37. # making sure the detected scan type is set (detected: telecine)
  38. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
  39. # converting interlaced to half-height progressive for filtering (vsCTMF) (separate fields)
  40. clip = core.std.SeparateFields(clip, tff=False) # resolution 1920x540
  41. clipEven = clip[::2]
  42. clipEven = core.std.SetFrameProps(clip=clipEven, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  43. clipOdd = clip[1::2]
  44. clipOdd = core.std.SetFrameProps(clip=clipOdd, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  45. # denoising using CTMF
  46. clipEven = core.ctmf.CTMF(clipEven, radius=1, memsize=1048576, opt=2)
  47. # denoising using CTMF
  48. clipOdd = core.ctmf.CTMF(clipOdd, radius=1, memsize=1048576, opt=2)
  49. # converting half-height progressive to interlaced
  50. clip = core.std.Interleave([clipEven, clipOdd])
  51. clip = core.std.DoubleWeave(clip=clip, tff=False) # resolution: 1920x1080
  52. clip = core.std.SelectEvery(clip, 2, 0) # scan type: bottom field first
  53. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
  54. # Deinterlacing using TIVTC
  55. clip = core.tivtc.TFM(clip)
  56. clip = core.tivtc.TDecimate(clip) # new fps: 23.976
  57. # Making sure content is preceived as frame based
  58. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  59. # adjusting color space from YUV420P8 to RGB24 for vsCCD
  60. clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_in_s="limited", range_s="full")
  61. # chroma denoising using CCD
  62. clip = core.zsmooth.CCD(clip, threshold=60.00, points=[True,True,False])
  63. # adjusting output color from RGB24 to YUV420P10 for NVEncModel
  64. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_in_s="full", range_s="limited", dither_type="error_diffusion") # additional resize to match target color sampling
  65. # set output frame rate to 23.976fps (progressive)
  66. clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
  67. # output
  68. clip.set_output()
  69. # script was created by Hybrid 2026.04.07.1
Advertisement
Add Comment
Please, Sign In to add comment