当前位置: 首页>>代码示例>>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;未经允许,请勿转载。