Guest User

Untitled

a guest
Jan 29th, 2026
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 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/ColorFilter/TimeCube/vscube.dll")
  16. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
  17. # Import scripts
  18. import color
  19. import validate
  20. # Source: 'C:\Users\Selur\Desktop\0001 pt 1-00.00.26.009-00.00.28.709.MP4'
  21. # Current color space: YUV420P8, bit depth: 8, resolution: 1440x1080, frame rate: 30fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, format: AVC
  22. # Loading 'C:\Users\Selur\Desktop\0001 pt 1-00.00.26.009-00.00.28.709.MP4' using DGSource
  23. clip = core.dgdecodenv.DGSource("J:/tmp/mp4_d5ca808afd56df4182c12d6a58241dd4_853323747.dgi") # 30 fps, scanorder: progressive
  24. frame = clip.get_frame(0)
  25. # setting color matrix to 709.
  26. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
  27. # setting color transfer (vs.TRANSFER_BT709), if it is not set.
  28. if validate.transferIsInvalid(clip):
  29. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
  30. # setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
  31. if validate.primariesIsInvalid(clip):
  32. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
  33. # setting color range to TV (limited) range.
  34. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
  35. # making sure frame rate is set to 30fps
  36. clip = core.std.AssumeFPS(clip=clip, fpsnum=30, fpsden=1)
  37. # making sure the detected scan type is set (detected: progressive)
  38. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
  39. clip = core.std.Crop(clip, left=48, right=76, top=80, bottom=0) # cropping to 1316x1000
  40. # adjusting color space from YUV420P8 to RGB24 for vsTimeCube
  41. clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_in_s="limited", range_s="full")
  42. # color adjustment using TimeCube
  43. clip = core.timecube.Cube(clip, cube="F:/Hybrid/64bit/vsfilters/ColorFilter/TimeCube/BT709_to_PQ.cube")
  44. # adjusting color space from RGB24 to YUV444PS for vsColorMatrix
  45. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444PS, matrix_s="709", range_in_s="full", range_s="limited", dither_type="error_diffusion") # additional resize to match target color sampling
  46. # ColorMatrix: adjusting color matrix from fcc to 709
  47. # adjusting luma range to 'limited' due to post clipping
  48. clip = core.resize.Bicubic(clip, matrix_in_s="fcc", matrix_s="709", range_in=0, range=0)
  49. # adjusting color space from YUV444PS to RGB48 for vsAutoWhite
  50. clip = core.resize.Bicubic(clip=clip, format=vs.RGB48, matrix_in_s="709", range_in_s="limited", range_s="full")
  51. # adjusting colors using AutoWhite
  52. clip = color.AutoWhite(clip)
  53. # adjusting color space from RGB48 to YUV444P16 for vsTweak
  54. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="709", range_in_s="full", range_s="limited") # additional resize to match target color sampling
  55. # adjusting color using Tweak
  56. clip = color.Tweak(clip, hue=-45.00, sat=1.10, cont=1.00, coring=True)
  57. # adjusting output color from YUV444P16 to YUV420P10 for NVEncModel
  58. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10)
  59. # set output frame rate to 30fps (progressive)
  60. clip = core.std.AssumeFPS(clip=clip, fpsnum=30, fpsden=1)
  61. # output
  62. clip.set_output()
  63. # script was created by Hybrid 2026.01.29.1
Advertisement
Add Comment
Please, Sign In to add comment