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


Python VideoFileClip.write_gif方法代碼示例

本文整理匯總了Python中moviepy.editor.VideoFileClip.write_gif方法的典型用法代碼示例。如果您正苦於以下問題:Python VideoFileClip.write_gif方法的具體用法?Python VideoFileClip.write_gif怎麽用?Python VideoFileClip.write_gif使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在moviepy.editor.VideoFileClip的用法示例。


在下文中一共展示了VideoFileClip.write_gif方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: make_small_gif

# 需要導入模塊: from moviepy.editor import VideoFileClip [as 別名]
# 或者: from moviepy.editor.VideoFileClip import write_gif [as 別名]
def make_small_gif(gif_path="F:\\input_gif.gif"):
    """
    shrink gif
    """
    output_file = 'F:\\\output.gif'
    video = VideoFileClip(gif_path).resize(0.6)
    length = int(video.fps * video.duration)
    
    video.write_gif(output_file,
                   fps=video.fps,
                   program="ffmpeg")
    

    new_frame_speed = int(1/(video.fps/2) * 100)
          
    options = ["gifsicle",
               output_file,
               '-O3',
               '-o', output_file
               
               ]
    result = subprocess.Popen(options,
                              stdout = subprocess.PIPE,
                              stderr = subprocess.STDOUT)
    for l in result.stdout.readlines():
        print l    
開發者ID:inkleby,項目名稱:inklebyrobots,代碼行數:28,代碼來源:culture_chef.py

示例2: avi_to_gif

# 需要導入模塊: from moviepy.editor import VideoFileClip [as 別名]
# 或者: from moviepy.editor.VideoFileClip import write_gif [as 別名]
def avi_to_gif(odbname):
    """converts an avi video file to an animated gif so that it can easily be
        easily inserted into a pptx
        avidir = 'customBeamExample'
    """
    avinames=glob.glob(os.path.dirname(odbname)+'/*.avi')
    for aviname in avinames:
        clip = VideoFileClip(aviname)
        clip.write_gif(os.path.splitext(aviname)[0]+'.gif')
開發者ID:GeoZac,項目名稱:mechpy,代碼行數:11,代碼來源:abaqus_report.py


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