视频优化器
通过使用以下自动化脚本,你不仅可以使用 Python 来优化视频,还可以使用它来优化图像。该脚本使用 Moviepy 模块,允许你修剪、添加音频、设置视频速度、添加 VFX 等等。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
import moviepy.editor as pyedit
video = pyedit.VideoFileClip("vid.mp4")
vid1 = video.subclip(0, 10) vid2 = video.subclip(20, 40) final_vid = pyedit.concatenate_videoclips([vid1, vid2])
final_vid = final_vid.speedx(2)
aud = pyedit.AudioFileClip("bg.mp3") final_vid = final_vid.set_audio(aud)
final_vid = final_vid.fx(pyedit.vfx.time_mirror)
vid1 = pyedit.VideoFileClip("vid1.mp4") vid2 = pyedit.VideoFileClip("vid2.mp4") final_vid = pyedit.concatenate_videoclips([vid1, vid2])
vid1 = final_vid.fx(pyedit.vfx.mirror_x) vid2 = final_vid.fx(pyedit.vfx.invert_colors) final_vid = pyedit.concatenate_videoclips([vid1, vid2])
img1 = pyedit.ImageClip("img1.jpg") img2 = pyedit.ImageClip("img2.jpg") final_vid = pyedit.concatenate_videoclips([img1, img2])
final_vid.write_videofile("final.mp4")
|