當前位置: 首頁>>代碼示例>>Python>>正文


Python VideoFileClip.write_videofile方法代碼示例

本文整理匯總了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
開發者ID:Ahome7490,項目名稱:watson-word-watcher,代碼行數:20,代碼來源:audio_video.py

示例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")
開發者ID:kevinkong91,項目名稱:Skycast-Python,代碼行數:7,代碼來源:trim.py

示例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
開發者ID:frederick623,項目名稱:Helloworld,代碼行數:8,代碼來源:vimeo_dl.py

示例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()
開發者ID:Forrest-Z,項目名稱:self-driving-car,代碼行數:31,代碼來源:main.py


注:本文中的moviepy.editor.VideoFileClip.write_videofile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。