Guest User

Untitled

a guest
Jul 5th, 2026
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 KB | None | 0 0
  1. # Imports
  2. import ctypes
  3. import sys
  4. import os
  5. import vapoursynth as vs
  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 Support Files
  14. Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  15. # loading plugins
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/libvs_placebo.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  19. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/bwdif.dll")
  20. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/sneedif/libsneedif.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libeedi3vk.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/addnoise.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvtools.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/zsmooth/zsmooth.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
  28. # Import scripts
  29. import linedarken
  30. import qtgmc
  31. import validate
  32. # Source: 'C:\Users\Selur\Desktop\sample.ts'
  33. # clip current meta; color space: YUV420P8, bit depth: 8, resolution: 1440x1080, fps: 29.97, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: top field first, full height: true (Source)
  34. # Loading 'C:\Users\Selur\Desktop\sample.ts' using DGSource
  35. clip = core.dgdecodenv.DGSource("J:/tmp/ts_3591dab47f54c59fc132a441faa50717_853323747.dgi",fieldop=0) # 29.97 fps, scanorder: top field first
  36. frame = clip.get_frame(0)
  37. # setting color matrix to 709.
  38. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
  39. # setting color transfer (vs.TRANSFER_BT709), if it is not set.
  40. if validate.transferIsInvalid(clip):
  41. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
  42. # setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
  43. if validate.primariesIsInvalid(clip):
  44. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
  45. # setting color range to TV (limited) range.
  46. prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
  47. clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})
  48. # making sure frame rate is set to 29.97fps
  49. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  50. # making sure the detected scan type is set (detected: top field first)
  51. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
  52. # Deinterlacing using QTGMC
  53. clip = qtgmc.QTGMC(clip, Preset="Fast", TFF=True, opencl=True) # new fps: 59.94
  54. # Making sure content is preceived as frame based
  55. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  56. # adjusting color space from YUV420P8 to YUV444P16 for vsGLSLAdaptiveSharpen
  57. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16)
  58. # sharpening using GLSL Adaptive Sharpening
  59. with open("F:/Hybrid/64bit/vsfilters/GLSL/parameterized/adaptive-sharpen.glsl") as glslf:
  60. glsl = glslf.read()
  61. glsl = glsl.replace('#define curve_height 1.0', '#define curve_height 1.0000')
  62. glsl = glsl.replace('#define anime_mode false', '#define anime_mode true')
  63. glsl = glsl.replace('#define overshoot_ctrl false', '#define overshoot_ctrl true')
  64. glsl = glsl.replace('#define video_level_out false', '#define video_level_out true')
  65. clip = core.placebo.Shader(clip, shader_s=glsl, width=clip.width, height=clip.height)
  66. # Using FastLineDarkenMOD for line darkening
  67. clip = linedarken.FastLineDarkenMOD(clip)
  68. # adjusting output color from YUV444P16 to YUV420P10 for NVEncModel
  69. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, dither_type="error_diffusion")
  70. # set output frame rate to 59.94fps (progressive)
  71. clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
  72. # output
  73. clip.set_output()
  74. # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 1440x1080, fps: 59.94, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
  75. # script was created by Hybrid 2026.07.05.1
Advertisement
Add Comment
Please, Sign In to add comment