本文整理汇总了Python中moviepy.editor.VideoFileClip.set_start方法的典型用法代码示例。如果您正苦于以下问题:Python VideoFileClip.set_start方法的具体用法?Python VideoFileClip.set_start怎么用?Python VideoFileClip.set_start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moviepy.editor.VideoFileClip
的用法示例。
在下文中一共展示了VideoFileClip.set_start方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save_out
# 需要导入模块: from moviepy.editor import VideoFileClip [as 别名]
# 或者: from moviepy.editor.VideoFileClip import set_start [as 别名]
def save_out(tracks, outfile=None, filetype='mp4'):
out = []
vids = [t for t in tracks if t['type'] == 'vid']
texts = [t for t in tracks if t['type'] == 'text']
for v in vids:
c = VideoFileClip(v['content']).subclip(v['in'], v['in'] + v['duration'])
c = c.set_start(v['start'])
out.append(c)
size = out[0].size
for t in texts:
c = create_sub(t['content'], size, rect_offset=195, min_height=55)
c = c.set_start(t['start'])
c = c.set_duration(t['duration'])
out.append(c)
final_clip = CompositeVideoClip(out)
if outfile is None:
outfile = 'msg_' + str(int(time.time())) + '.mp4'
if filetype == 'gif':
outfile = outfile.replace('.mp4', '.gif')
final_clip.speedx(1.7).write_gif(outfile, fps=7, loop=1)
else:
final_clip.write_videofile(outfile, fps=24, codec='libx264')
return outfile
示例2: add_intro
# 需要导入模块: from moviepy.editor import VideoFileClip [as 别名]
# 或者: from moviepy.editor.VideoFileClip import set_start [as 别名]
def add_intro(self):
for _, _, filenames in os.walk('../intros'):
choice = os.path.join("../intros", random.choice(filenames))
sys.stdout.write("Adding intro: %s\n" % choice)
clip = VideoFileClip(choice)
clip = clip.set_start(0)
return clip
示例3: video
# 需要导入模块: from moviepy.editor import VideoFileClip [as 别名]
# 或者: from moviepy.editor.VideoFileClip import set_start [as 别名]
def video(filename, username, t0):
# Orignal Video
original = VideoFileClip("static/videos/"+filename+".mp4")
first_half = VideoFileClip("static/videos/"+filename+".mp4").subclip(0, t0)
second_half = VideoFileClip("static/videos/"+filename+".mp4").subclip(t0+1, original.duration)
original.save_frame("static/videos/frame.png", t=t0)
img = Image.open("static/videos/frame.png").convert(mode='RGB')
stepic.encode_inplace(img, username)
msg = stepic.decode(img)
print(msg)
img.save("static/videos/frame.png")
encoded_clip = ImageClip('static/videos/frame.png', duration=1)
new_mov = CompositeVideoClip([first_half.set_start(0),
encoded_clip.set_start(t0),
second_half.set_start(t0+1)])
# Write the result to a file (many options available !)
new_mov.write_videofile("static/"+username+"_"+filename+".avi", codec='png')