本文整理匯總了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()