本文整理汇总了Python中moviepy.editor.VideoFileClip.write_videofile方法的典型用法代码示例。如果您正苦于以下问题:Python VideoFileClip.write_videofile方法的具体用法?Python VideoFileClip.write_videofile怎么用?Python VideoFileClip.write_videofile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moviepy.editor.VideoFileClip
的用法示例。
在下文中一共展示了VideoFileClip.write_videofile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convert_to_mp4_file
# 需要导入模块: from moviepy.editor import VideoFileClip [as 别名]
# 或者: from moviepy.editor.VideoFileClip import write_videofile [as 别名]
def convert_to_mp4_file(src_path, dest_path,
video_codec=DEFAULT_VIDEO_CODEC,
audio_codec=DEFAULT_VIDEO_AUDIO_CODEC):
"""
Takes an existing movie file and converts it to mp4
src_path (str): full path to the video file to be copied/processed
dest_path (str): full path to where the video file should be copied
video_codec (str): optional string to specify a codec. Otherwise
all copied videos will be mp4 regardless of extension
returns: dest_path
"""
movie = VideoFileClip(src_path)
movie.write_videofile(dest_path, codec=video_codec, audio_codec=audio_codec)
return dest_path
示例2: VideoFileClip
# 需要导入模块: from moviepy.editor import VideoFileClip [as 别名]
# 或者: from moviepy.editor.VideoFileClip import write_videofile [as 别名]
from moviepy.editor import VideoFileClip, concatenate_videoclips
clip1 = VideoFileClip("partly_cloudy.mp4").subclip(747, 759)
clip1.fps = 15
clip1.write_videofile("partly_cloudy_short.mp4")
示例3: combine
# 需要导入模块: from moviepy.editor import VideoFileClip [as 别名]
# 或者: from moviepy.editor.VideoFileClip import write_videofile [as 别名]
def combine(video_file, audio_file):
video_clip = VideoFileClip(video_file)
video_clip.write_videofile(os.path.join("/Users/frederickli/Downloads", os.path.basename(video_file.replace("video_", ""))), audio=audio_file)
os.remove(video_file)
os.remove(audio_file)
return
示例4: calibrate_camera
# 需要导入模块: from moviepy.editor import VideoFileClip [as 别名]
# 或者: from moviepy.editor.VideoFileClip import write_videofile [as 别名]
return blend_output
if __name__ == '__main__':
# first things first: calibrate the camera
ret, mtx, dist, rvecs, tvecs = calibrate_camera(calib_images_dir='camera_cal')
mode = 'images'
if mode == 'video':
selector = 'project'
clip = VideoFileClip('{}_video.mp4'.format(selector)).fl_image(process_pipeline)
clip.write_videofile('out_{}_{}.mp4'.format(selector, time_window), audio=False)
else:
test_img_dir = 'test_images'
for test_img in os.listdir(test_img_dir):
frame = cv2.imread(os.path.join(test_img_dir, test_img))
blend = process_pipeline(frame, keep_state=False)
cv2.imwrite('output_images/{}'.format(test_img), blend)
plt.imshow(cv2.cvtColor(blend, code=cv2.COLOR_BGR2RGB))
plt.show()