我用moviepy和gizeh写了一个小python程序(感谢Zulko)。它在屏幕上显示并移动文本字符串"my_text“,运行良好。
<!-- language: python -->
# Import everything needed to edit video clips
from moviepy.editor import *
import random
import gizeh
# RESOLUTION
W = 1280
H = 720
duration = 5
def make_frame(t):
surface = gizeh.Surface(W,H)
text = gizeh.text("my_text", fontsize = 80, fontfamily="Impact",
fill=(1,1,1), xy=(W/2, (min(340,-340+1000*t) )))
text.draw(surface)
return surface.get_npimage()
clip2 = VideoClip(make_frame, duration=duration)
clip2.write_videofile("my_video.avi",fps=12, codec='libx264')我的编程技术很差。我想使用文本字符串列表"my_text1","my_text2","my_text3"...而不仅仅是一个字符串"my_text“。此外,这些列表元素应该连续出现在屏幕上,而不是同时出现。有人能帮我找到解决这个问题的正确方向吗?
https://stackoverflow.com/questions/47501517
复制相似问题