A collection of MoviePy scripts for one-off / recurring tasks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.4 KiB

  1. #!/bin/python3
  2. #
  3. # apex_spedup.py - generate sped up videos of Apex
  4. import moviepy.editor as mp
  5. import glob
  6. import os
  7. INPUTVIDEO = "/tmp/footage/gamefootage/pending/apex/2020-12-05 17-29-55.mkv"
  8. WORKINGDIR = "/tmp/footage/gamefootage/pending/apex"
  9. PATTERN = "2020-12-05*.mkv"
  10. for filepath in glob.glob(os.path.join(WORKINGDIR, PATTERN)):
  11. inputvideo = filepath
  12. outputvideo = str(inputvideo).replace(".mkv", "-spedup.mkv")
  13. print("Converting {} to {}".format(inputvideo, outputvideo))
  14. clip = mp.VideoFileClip(inputvideo, audio=False)
  15. clip = clip.fadein(0.5).fadeout(0.5)
  16. newclip = clip.fx(mp.vfx.accel_decel, 60)
  17. logoclip = mp.ImageClip("/home/robert/downloads/apex-logo2.png")
  18. # Duke-Fill
  19. # textclip = mp.TextClip("Recorded without audio so sped up",
  20. # font="Blocktastic",
  21. # fontsize=50,
  22. # color="#e0e0e0")
  23. textclip = mp.ImageClip("/home/robert/downloads/sped_up.png")
  24. logoclip = logoclip.set_duration(newclip.duration).set_opacity(0.6)
  25. textclip = textclip.set_duration(newclip.duration).set_opacity(0.8)
  26. composite = mp.CompositeVideoClip(
  27. [newclip,
  28. logoclip.set_position((0.75, 0.65), relative=True),
  29. textclip.set_position((0.05, 0.8), relative=True)])
  30. # composite.preview()
  31. composite.write_videofile(outputvideo, codec="libx264", threads=6)