當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。