Guest User

Untitled

a guest
Jul 15th, 2025
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 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. # Import scripts folder
  8. scriptPath = 'F:/Hybrid/64bit/vsscripts'
  9. sys.path.insert(0, os.path.abspath(scriptPath))
  10. # loading plugins
  11. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  12. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
  13. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
  14. # Import scripts
  15. import validate
  16. # Source: 'C:\Users\Selur\Desktop\sample_FINE_720.mp4'
  17. # Current color space: YUV420P8, bit depth: 8, resolution: 1280x720, frame rate: 23.976fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709, format: AVC
  18. # Loading C:\Users\Selur\Desktop\sample_FINE_720.mp4 using DGSource
  19. clip = core.dgdecodenv.DGSource("J:/tmp/mp4_2b5f81df175fe091cb10549a6329d5db_853323747.dgi")# 23.976 fps, scanorder: progressive
  20. frame = clip.get_frame(0)
  21. # setting color matrix to 709.
  22. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
  23. # setting color transfer (vs.TRANSFER_BT709), if it is not set.
  24. if validate.transferIsInvalid(clip):
  25. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
  26. # setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
  27. if validate.primariesIsInvalid(clip):
  28. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
  29. # setting color range to TV (limited) range.
  30. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
  31. # making sure frame rate is set to 23.976fps
  32. clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
  33. # making sure the detected scan type is set (detected: progressive)
  34. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
  35. # changing range from limited to full range for vsProPainter
  36. clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
  37. # setting color range to PC (full) range.
  38. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_FULL)
  39. # adjusting color space from YUV420P8 to RGB24 for vsProPainter
  40. clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_s="full")
  41. # Inpainting using ProPainter
  42. from vspropainter import propainter as ProPainter
  43. clipMask = core.lsmas.LWLibavSource(source="G:/Output/mask.mp4", format="RGB24", cache=0)
  44. clip = ProPainter(clip=clip, clip_mask=clipMask, length=12, mask_dilation=12, mask_region=(500,256,380,240))
  45. # changing range from full to limited range for vsProPainter
  46. clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
  47. # adjusting output color from: RGB24 to YUV420P10 for NVEncModel
  48. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited")
  49. # set output frame rate to 23.976fps (progressive)
  50. clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
  51. # output
  52. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment