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


Python VideoFileClip.write_videofile方法代码示例

本文整理汇总了Python中moviepy.video.io.VideoFileClip.VideoFileClip.write_videofile方法的典型用法代码示例。如果您正苦于以下问题:Python VideoFileClip.write_videofile方法的具体用法?Python VideoFileClip.write_videofile怎么用?Python VideoFileClip.write_videofile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在moviepy.video.io.VideoFileClip.VideoFileClip的用法示例。


在下文中一共展示了VideoFileClip.write_videofile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_toimageclip

# 需要导入模块: from moviepy.video.io.VideoFileClip import VideoFileClip [as 别名]
# 或者: from moviepy.video.io.VideoFileClip.VideoFileClip import write_videofile [as 别名]
def test_toimageclip():
    clip = VideoFileClip("media/big_buck_bunny_432_433.webm").subclip(0.2, 0.6)
    clip = clip.to_ImageClip(t=0.1, duration=0.4)
    location = os.path.join(TMP_DIR, "toimageclip.mp4")
    clip.write_videofile(location, fps=24)
    assert os.path.isfile(location)
    close_all_clips(locals())
开发者ID:Zulko,项目名称:moviepy,代码行数:9,代码来源:test_VideoClip.py

示例2: test_setopacity

# 需要导入模块: from moviepy.video.io.VideoFileClip import VideoFileClip [as 别名]
# 或者: from moviepy.video.io.VideoFileClip.VideoFileClip import write_videofile [as 别名]
def test_setopacity():
    clip = VideoFileClip("media/big_buck_bunny_432_433.webm").subclip(0.2, 0.6)
    clip = clip.set_opacity(0.5)
    clip = clip.on_color(size=(1000, 1000), color=(0, 0, 255), col_opacity=0.8)
    location = os.path.join(TMP_DIR, "setopacity.mp4")
    clip.write_videofile(location)
    assert os.path.isfile(location)
    close_all_clips(locals())
开发者ID:Zulko,项目名称:moviepy,代码行数:10,代码来源:test_VideoClip.py

示例3: test_check_codec

# 需要导入模块: from moviepy.video.io.VideoFileClip import VideoFileClip [as 别名]
# 或者: from moviepy.video.io.VideoFileClip.VideoFileClip import write_videofile [as 别名]
def test_check_codec():
    clip = VideoFileClip("media/big_buck_bunny_432_433.webm")
    location = os.path.join(TMP_DIR, "not_a_video.mas")
    try:
        clip.write_videofile(location)
    except ValueError as e:
        assert "MoviePy couldn't find the codec associated with the filename." \
               " Provide the 'codec' parameter in write_videofile." in str(e)
    close_all_clips(locals())
开发者ID:Zulko,项目名称:moviepy,代码行数:11,代码来源:test_VideoClip.py

示例4: download_and_convert

# 需要导入模块: from moviepy.video.io.VideoFileClip import VideoFileClip [as 别名]
# 或者: from moviepy.video.io.VideoFileClip.VideoFileClip import write_videofile [as 别名]
def download_and_convert(url):
	print("converting url " + url)
	source = pafy.new(url)
	best = source.getbest(preftype="mp4")
	ts = datetime.datetime.fromtimestamp(time.time()).strftime('%Y%m%d-%H%M%S')
	input_filename = "/tmp/" + ts + "." + best.extension

	best.download(filepath=input_filename)
	output = VideoFileClip(input_filename)
	duration = output.duration
	
	output_filename="/tmp/" + best.title + "." + best.extension

	output = output.set_audio(audio).fl_time(lambda t: t * accel, apply_to='mask').set_duration(duration / accel)
	output.write_videofile(output_filename)

	print("uploading to s3")

	s3 = boto.connect_s3()
	bucket = s3.get_bucket('bennyhill')
	key = Key(bucket)
	key.key = best.title + "-" + ts
	key.set_contents_from_filename(output_filename)

	output_url = key.generate_url(expires_in=3600)

	print("complete")

	# save the results
	try:
		result = Result(
			url=url,
			youtube_url=output_url
		)
		db.session.add(result)
		db.session.commit()
		return result.id
	except:
		errors.append("Unable to add item to database.")
		return {"error": errors}
开发者ID:xuloo,项目名称:bennyhillmachine,代码行数:42,代码来源:app.py


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