Advertisement
Guest User

Untitled

a guest
Apr 21st, 2025
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 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/Support/libmvtools.dll")
  12. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
  13. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
  14. # defining beforeFillDuplicateFrames-function - START
  15. def beforeFillDuplicateFrames(clip):
  16. # framerate 50
  17. import ChangeFPS
  18. clip = ChangeFPS.ChangeFPS(clip, target_fps_num=50, target_fps_den=1)
  19. return clip
  20. # defining beforeFillDuplicateFrames-function - END
  21.  
  22. # Import scripts
  23. import validate
  24. # Source: 'G:\TestClips&Co\files\test.avi'
  25. # Current color space: YUV420P8, bit depth: 8, resolution: 640x352, frame rate: 25fps, scanorder: progressive, yuv luminance scale: limited, matrix: 470bg, format: MPEG-4 Visual
  26. # Loading G:\TestClips&Co\files\test.avi using LWLibavSource
  27. clip = core.lsmas.LWLibavSource(source="G:/TestClips&Co/files/test.avi", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
  28. frame = clip.get_frame(0)
  29. # setting color matrix to 470bg.
  30. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
  31. # setting color transfer (vs.TRANSFER_BT601), if it is not set.
  32. if validate.transferIsInvalid(clip):
  33. clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
  34. # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
  35. if validate.primariesIsInvalid(clip):
  36. clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
  37. # setting color range to TV (limited) range.
  38. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
  39. # making sure frame rate is set to 25fps
  40. clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
  41. # making sure the detected scan type is set (detected: progressive)
  42. clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
  43. clip = beforeFillDuplicateFrames(clip)
  44. # current meta; color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 50, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive, full height: true
  45. from FillDuplicateFrames import FillDuplicateFrames
  46. fdf = FillDuplicateFrames(clip=clip, method="MV")
  47. clip = fdf.out
  48.  
  49. # adjusting output color from: YUV420P8 to YUV420P10 for NVEncModel
  50. clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
  51. # set output frame rate to 50fps (progressive) due to 'Change speed
  52. clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
  53. # output
  54. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement