Guest User

derainbow

a guest
May 16th, 2026
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.15 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/vsfilters/DenoiseFilter/Cnr2/libcnr2.dll")
  17. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/MSmooth/libmsmoosh.dll")
  18. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/vsnlm_cuda.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/DenoiseFilter/DFTTest/DFTTest.dll")
  21. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
  22. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
  23. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
  24. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libeedi3vk.dll")
  25. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/addnoise.dll")
  26. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvtools.dll")
  27. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.dll")
  28. core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/zsmooth/zsmooth.dll")
  29. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DerainbowFilter/DeCross/libdecross.dll")
  30. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
  31. # Import scripts
  32. import edi_rpow2
  33. import fromDoom9
  34. import derainbow
  35. import qtgmc
  36. import validate
  37. # Source: 'G:\clips\rainbows\output.mkv'
  38. # clip current meta; color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, color primaries: Unspecific, color transfer: BT.601, yuv luminance scale: limited, scanorder: top field first, full height: true ((Source))
  39. # Loading 'G:\clips\rainbows\output.mkv' using DGSource
  40. clip = core.dgdecodenv.DGSource("J:/tmp/mkv_32aadea3e3412fbbdf318f8d53a89756_853323747.dgi",fieldop=0) # 29.97 fps, scanorder: top field first
  41. frame = clip.get_frame(0)
  42. # setting color matrix to 470bg.
  43. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
  44. # setting color transfer (vs.TRANSFER_BT601), if it is not set.
  45. if validate.transferIsInvalid(clip):
  46. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
  47. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  48. if validate.primariesIsInvalid(clip):
  49. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  50. # setting color range to TV (limited) range.
  51. prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
  52. clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})
  53. # making sure frame rate is set to 29.97fps
  54. clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
  55. # making sure the detected scan type is set (detected: top field first)
  56. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
  57. # cutting from frame 2450 to 3249 - WARNING: This might cause synch issues
  58. clip = core.std.Trim(clip=clip, first=2450, last=3249)
  59. # rainbow removal using DeCross
  60. clip = core.decross.DeCross(clip, thresholdy=1, noise=80, margin=2)
  61. # Deinterlacing using QTGMC
  62. clip = qtgmc.QTGMC(clip, Preset="Fast", TFF=True, opencl=True) # new fps: 59.94
  63. # Making sure content is preceived as frame based
  64. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  65. clip = core.std.Crop(clip, left=8, right=8, top=0, bottom=0) # cropping to 704x480
  66. # rainbow removal using LUTDeRainbow
  67. clip = derainbow.LUTDeRainbow(clip, cthresh=20, ythresh=60)
  68. # denoising using KNLMeansCL
  69. clip = core.nlm_cuda.NLMeans(clip, a=6, h=5.00, channels="UV")
  70. # removing flickering using Small Deflicker
  71. clip = fromDoom9.Small_Deflicker(clip, preset=3, cnr=True)
  72. # resizing using NNEDI3CL
  73. # current: 704x480 target: 1280x982
  74. clip = edi_rpow2.nnedi3cl_rpow2(clip, rfactor=4, nsize=3, nns=4) # 2816x1920
  75. # resizing 2816x1920 to 1280x982
  76. clip = core.fmtc.resample(clip, w=1280, h=982, kernel="spline64", interlaced=False, interlacedd=False) # before YUV420P8 after YUV420P16
  77. # adjusting output color from YUV420P16 to YUV420P10 for NVEncModel
  78. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, dither_type="error_diffusion")
  79. # set output frame rate to 59.94fps (progressive)
  80. clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
  81. # output
  82. clip.set_output()
  83. # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 1280x982, fps: 59.94, color matrix: 470bg, color primaries: Unspecific, color transfer: BT.601, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
  84. # script was created by Hybrid 2026.05.16.1
Advertisement
Add Comment
Please, Sign In to add comment