当前位置: 首页>>代码示例>>Python>>正文


Python VideoFileClip.set_start方法代码示例

本文整理汇总了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
开发者ID:UnforeseenOcean,项目名称:stocktalk,代码行数:31,代码来源:stocktalk.py

示例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
开发者ID:LumbaJack,项目名称:Vine-Compilation-Bot,代码行数:10,代码来源:makevideo_helper.py

示例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')
开发者ID:tcyrus-archive,项目名称:scurvy-webapp,代码行数:25,代码来源:encrypt.py


注:本文中的moviepy.editor.VideoFileClip.set_start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。