Advertisement
Guest User

Replace duplicates using FillDuplicateFrames with RIFE

a guest
Jun 6th, 2023
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. # Imports
  2. import vapoursynth as vs
  3. import os
  4. import sys
  5. # getting Vapoursynth core
  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/FrameFilter/RIFE/librife.dll")
  13. core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
  14. # source: 'C:\Users\Selur\Desktop\M3.avi'
  15. # current color space: RGB24, bit depth: 8, resolution: 1280x720, fps: 30, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
  16. # Loading C:\Users\Selur\Desktop\M3.avi using LWLibavSource
  17. clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/M3.avi", format="RGB24", stream_index=0, cache=0, fpsnum=30, prefer_hw=0)
  18. # Setting color transfer info (709), when it is not set
  19. clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=1)
  20. # Setting color primaries info (), when it is not set
  21. clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=1)
  22. # Setting color range to TV (limited) range.
  23. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
  24. # making sure frame rate is set to 30
  25. clip = core.std.AssumeFPS(clip=clip, fpsnum=30, fpsden=1)
  26. clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
  27. # adjusting color space from RGB24 to RGBS for vsFillDuplicateFrames
  28. clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, range_s="limited")
  29. from FillDuplicateFrames import FillDuplicateFrames
  30. fdf = FillDuplicateFrames(clip=clip, method="RIFE")
  31. clip = fdf.out
  32. # adjusting output color from: RGBS to YUV444P8 for x264Model
  33. clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="709", range_s="limited", dither_type="error_diffusion")
  34. # set output frame rate to 30fps (progressive)
  35. clip = core.std.AssumeFPS(clip=clip, fpsnum=30, fpsden=1)
  36. # Output
  37. clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement