浏览代码

Add apex_spedup - speed up audioless videos to 1m

master
bertieb 4 年前
父节点
当前提交
3c7b9cfcee
共有 1 个文件被更改,包括 42 次插入0 次删除
  1. +42
    -0
      apex_spedup.py

+ 42
- 0
apex_spedup.py 查看文件

@@ -0,0 +1,42 @@
#!/bin/python3
#
# apex_spedup.py - generate sped up videos of Apex

import moviepy.editor as mp
import glob
import os

INPUTVIDEO = "/tmp/footage/gamefootage/pending/apex/2020-12-05 17-29-55.mkv"

WORKINGDIR = "/tmp/footage/gamefootage/pending/apex"
PATTERN = "2020-12-05*.mkv"

for filepath in glob.glob(os.path.join(WORKINGDIR, PATTERN)):
inputvideo = filepath
outputvideo = str(inputvideo).replace(".mkv", "-spedup.mkv")
print("Converting {} to {}".format(inputvideo, outputvideo))

clip = mp.VideoFileClip(inputvideo, audio=False)
clip = clip.fadein(0.5).fadeout(0.5)
newclip = clip.fx(mp.vfx.accel_decel, 60)

logoclip = mp.ImageClip("/home/robert/downloads/apex-logo2.png")

# Duke-Fill
# textclip = mp.TextClip("Recorded without audio so sped up",
# font="Blocktastic",
# fontsize=50,
# color="#e0e0e0")

textclip = mp.ImageClip("/home/robert/downloads/sped_up.png")

logoclip = logoclip.set_duration(newclip.duration).set_opacity(0.6)
textclip = textclip.set_duration(newclip.duration).set_opacity(0.8)

composite = mp.CompositeVideoClip(
[newclip,
logoclip.set_position((0.75, 0.65), relative=True),
textclip.set_position((0.05, 0.8), relative=True)])

# composite.preview()
composite.write_videofile(outputvideo, codec="libx264", threads=6)

正在加载...
取消
保存