Guest User

Untitled

a guest
Jan 11th, 2026
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. # Imports
  2. import vapoursynth as vs
  3. # getting Vapoursynth core
  4. import sys
  5. import os
  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/Support/akarin.dll")
  14. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/vszip.dll")
  15. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/BestSource/BestSource.dll")
  16. # defining beforeAutoGain-function - START
  17. def beforeAutoGain(clip):
  18. # requires colorformat YUV444PS
  19. import color
  20. min_val = 16/255.0 # ≈ 0.0627451
  21. max_val = 235/255.0 # ≈ 0.9215686
  22. limit = 0.15
  23. for i in range(20):
  24. clip = color.Tweak(clip, hue=0.00, sat=1.00, cont=1.00, bright=-limit, coring=True)
  25. clip = core.std.Limiter(clip, min=min_val, max=max_val, planes=[0])
  26. clip = color.Tweak(clip, hue=0.00, sat=1.00, cont=1.00, bright=limit, coring=True)
  27. return [clip]
  28. # defining beforeAutoGain-function - END
  29.  
  30. # Import scripts
  31. import color
  32. import validate
  33. # Source: 'C:/Users/Selur/Desktop/4uHeJFa.png'
  34. # Current color space: RGB24, bit depth: 8, resolution: 778x528, frame rate: 25fps, scanorder: progressive, yuv luminance scale: limited, matrix: 240m, format: PNG
  35. # Loading 'C:/Users/Selur/Desktop/4uHeJFa.png' using BestSource
  36. clip = core.bs.VideoSource(source="C:/Users/Selur/Desktop/4uHeJFa.png", cachepath="J:/tmp/4uHeJFa_bestSource", hwdevice="opencl")
  37. clip = core.std.Loop(clip=clip, times=100)
  38. frame = clip.get_frame(0)
  39. # setting color transfer (vs.TRANSFER_BT601), if it is not set.
  40. if validate.transferIsInvalid(clip):
  41. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
  42. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  43. if validate.primariesIsInvalid(clip):
  44. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  45. # making sure frame rate is set to 25fps
  46. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  47. # making sure the detected scan type is set (detected: progressive)
  48. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  49. # adjusting color format to YUV444PS for custom section
  50. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444PS, matrix_s="240m", range_in_s="full", range_s="limited", dither_type="error_diffusion") # additional resize to match target color sampling
  51. [clip] = beforeAutoGain(clip)
  52. # clip current meta; color space: YUV444PS, bit depth: 32, resolution: 778x528, fps: 25, color matrix: 240m, yuv luminance scale: limited, scanorder: progressive, full height: true
  53. # adjusting color space from YUV444PS to RGB48 for vsAutoWhite
  54. clip = core.resize.Bicubic(clip=clip, format=vs.RGB48, matrix_in_s="240m", range_in_s="limited", range_s="full")
  55. # adjusting colors using AutoWhite
  56. clip = color.AutoWhite(clip)
  57. # adjusting output color from RGB48 to YUV420P10 for NVEncModel
  58. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="240m", range_in_s="full", range_s="limited") # additional resize to match target color sampling
  59. # set output frame rate to 25fps (progressive)
  60. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  61. # output
  62. clip.set_output()
  63. # script was created by Hybrid 2026.01.11.1
Advertisement
Add Comment
Please, Sign In to add comment