精华内容
下载资源
问答
  • 玩转MoviePy - MoviePy安装

    千次阅读 2018-08-03 00:19:14
    玩转MoviePy - MoviePy安装 pip install moviepy

    玩转MoviePy - MoviePy安装

    MoviePy官网

    安装

    pip install moviepy

    检验

    
    from moviepy.editor import *
    from moviepy.audio.fx import all
    
    # 中文字体名字不能含有中文
    FONT_URL = './font/heimi.TTF'
    input_video="input_video.mp4"
    output_video="output_video.mp4"
    
    # 剪个10s的720x1280px的视频
    background_clip = VideoFileClip(input_video, target_resolution=(720, 1280)).subclip(0, 10)
    # 音乐只要前10s
    audio_clip = AudioFileClip('yuna.mp3').subclip(0, 10)
    background_clip = background_clip.set_audio(audio_clip)
    # 左下角加文字, 持续10s
    text_clip1 = TextClip('我是左下角', fontsize=30, color='white', font=FONT_URL)
    text_clip1 = text_clip1.set_position(('left', 'bottom'))
    text_clip1 = text_clip1.set_duration(10)
    # 右下角加文字, 持续3s
    text_clip2 = TextClip('我是右下角', fontsize=30, color='white', font=FONT_URL)
    text_clip2 = text_clip2.subclip(0, 3).set_position(('right', 'bottom'))
    image_clip = ImageClip('shuoGG.png')
    # 图片放中间, 从第2s开始播持续6s
    image_clip = image_clip.set_duration(6).set_position('center').set_start(2)
    video = CompositeVideoClip([background_clip, text_clip1, text_clip2, image_clip])
    # 调节音量
    video = all.volumex(video, 0.8)
    video.write_videofile(output_video)
    

    版权声明:转载必须注明本文转自 East196 的博客:http://blog.csdn.net/east196

    展开全文
  • Py之moviepy:python库之moviepy的简介、安装、使用方法详细攻略 目录 moviepy的简介 moviepy的安装 moviepy的使用方法 1、官方案例 moviepy的简介 Python有些出色的数据可视化库,但很少能渲染...

    Py之moviepy:python库之moviepy的简介、安装、使用方法详细攻略

     

     

     

    目录

    moviepy的简介

    moviepy的安装

    moviepy的使用方法

    1、官方案例


     

     

    moviepy的简介

           Python有些出色的数据可视化库,但很少能渲染GIF或视频动画。本文介绍如何运用MoviePy作为其他库的通用动画插件。  有了 MoviePy ,你可以用一个函数 make_frame(t) 自定义动画,并返回相应的时间t的视频帧(秒)。通过moviepy的官网看到依赖的库有Numpy,imageio, Decorator, and tqdm,而我的anaconda3安装时缺少tqdm(使用conda list能看到)

          MoviePy(全套文件)是一个用于视频编辑Python库:切割、拼接、标题插入,视频合成(即非线性编辑),视频处理和自定义效果的创造。请查看库中使用的一些示例。moviepy可以读写所有常见的音频和视频格式,如GIF,和运行在Windows / Mac / Linux,Python 2.7 + 3。这里是行动在IPython笔记本:

     

     

     

    moviepy的安装

    pip install moviepy

     

    20200630更新

    pip install --upgrade moviepy

     

     

     

    moviepy的使用方法

    1、官方案例

    在本例中,我们打开一个视频文件,选择t=50s和t=60s之间的子剪辑,在屏幕中央添加一个标题,然后将结果写入一个新文件:

    from moviepy.editor import *
    
    video = VideoFileClip("myHolidays.mp4").subclip(50,60)
    
    # Make the text. Many more options are available.
    txt_clip = ( TextClip("My Holidays 2013",fontsize=70,color='white')
                 .set_position('center')
                 .set_duration(10) )
    
    result = CompositeVideoClip([video, txt_clip]) # Overlay text on video
    result.write_videofile("myHolidays_edited.webm",fps=25) # Many options...

     

     

     

     

     

     

     

     

     

    展开全文
  • Python moviepy

    2020-06-12 08:57:08
    Python使用tkinter+moviepy+pyaudio开发视频播放器 2. 安装库 pip install moviepy 实质访问的下载网站是https://pypi.Python.org/simple/,这是一个国外网站,速度比较慢 如果使用国外的源下载速度慢,我们可以...

    1. 使用实例

    2. 安装库

    pip install moviepy
    

    实质访问的下载网站是https://pypi.Python.org/simple/,这是一个国外网站,速度比较慢

    如果使用国外的源下载速度慢,我们可以使用国内源提速:

    • 豆瓣源
      pip3 install moviepy -i https://pypi.douban.com/simple
      
    • 清华大学源
      pip3 install moviepy -i https://pypi.tuna.tsinghua.edu.cn/simple
      

    3. 导入库

    from moviepy.editor import VideoFileClip
    

    主页:https://pypi.org/project/moviepy/

    4. 读取视频到内存

    video = VideoFileClip("a.mp4")
    

    5. 打印视频的属性

    print(video.fps)
    print(video.h)
    print(video.w)
    

    6. 保存视频

    video.write_videofile("b.mp4", fps=15)
    
    Help on method write_videofile in module moviepy.video.VideoClip:
    
    write_videofile(filename, fps=None, codec=None, bitrate=None, audio=True, audio_fps=44100, preset='medium', audio_nbytes=4, audio_codec=None, audio_bitrate=None, audio_bufsize=2000, temp_audiofile=None, rewrite_audio=True, remove_temp=True, write_logfile=False, verbose=True, threads=None, ffmpeg_params=None, logger='bar') method of moviepy.video.io.VideoFileClip.VideoFileClip instance
        Write the clip to a videofile.
        
        Parameters
        -----------
        
        filename
          Name of the video file to write in.
          The extension must correspond to the "codec" used (see below),
          or simply be '.avi' (which will work with any codec).
        
        fps
          Number of frames per second in the resulting video file. If None is
          provided, and the clip has an fps attribute, this fps will be used.
        
        codec
          Codec to use for image encoding. Can be any codec supported
          by ffmpeg. If the filename is has extension '.mp4', '.ogv', '.webm',
          the codec will be set accordingly, but you can still set it if you
          don't like the default. For other extensions, the output filename
          must be set accordingly.
        
          Some examples of codecs are:
        
          ``'libx264'`` (default codec for file extension ``.mp4``)
          makes well-compressed videos (quality tunable using 'bitrate').
        
        
          ``'mpeg4'`` (other codec for extension ``.mp4``) can be an alternative
          to ``'libx264'``, and produces higher quality videos by default.
        
        
          ``'rawvideo'`` (use file extension ``.avi``) will produce
          a video of perfect quality, of possibly very huge size.
        
        
          ``png`` (use file extension ``.avi``) will produce a video
          of perfect quality, of smaller size than with ``rawvideo``.
        
        
          ``'libvorbis'`` (use file extension ``.ogv``) is a nice video
          format, which is completely free/ open source. However not
          everyone has the codecs installed by default on their machine.
        
        
          ``'libvpx'`` (use file extension ``.webm``) is tiny a video
          format well indicated for web videos (with HTML5). Open source.
        
        
        audio
          Either ``True``, ``False``, or a file name.
          If ``True`` and the clip has an audio clip attached, this
          audio clip will be incorporated as a soundtrack in the movie.
          If ``audio`` is the name of an audio file, this audio file
          will be incorporated as a soundtrack in the movie.
        
        audiofps
          frame rate to use when generating the sound.
        
        temp_audiofile
          the name of the temporary audiofile to be generated and
          incorporated in the the movie, if any.
        
        audio_codec
          Which audio codec should be used. Examples are 'libmp3lame'
          for '.mp3', 'libvorbis' for 'ogg', 'libfdk_aac':'m4a',
          'pcm_s16le' for 16-bit wav and 'pcm_s32le' for 32-bit wav.
          Default is 'libmp3lame', unless the video extension is 'ogv'
          or 'webm', at which case the default is 'libvorbis'.
        
        audio_bitrate
          Audio bitrate, given as a string like '50k', '500k', '3000k'.
          Will determine the size/quality of audio in the output file.
          Note that it mainly an indicative goal, the bitrate won't
          necessarily be the this in the final file.
        
        preset
          Sets the time that FFMPEG will spend optimizing the compression.
          Choices are: ultrafast, superfast, veryfast, faster, fast, medium,
          slow, slower, veryslow, placebo. Note that this does not impact
          the quality of the video, only the size of the video file. So
          choose ultrafast when you are in a hurry and file size does not
          matter.
        
        threads
          Number of threads to use for ffmpeg. Can speed up the writing of
          the video on multicore computers.
        
        ffmpeg_params
          Any additional ffmpeg parameters you would like to pass, as a list
          of terms, like ['-option1', 'value1', '-option2', 'value2'].
        
        write_logfile
          If true, will write log files for the audio and the video.
          These will be files ending with '.log' with the name of the
          output file in them.
        
        logger
          Either "bar" for progress bar or None or any Proglog logger.
        
        verbose (deprecated, kept for compatibility)
          Formerly used for toggling messages on/off. Use logger=None now.
        
        Examples
        ========
        
        >>> from moviepy.editor import VideoFileClip
        >>> clip = VideoFileClip("myvideo.mp4").subclip(100,120)
        >>> clip.write_videofile("my_new_video.mp4")
        >>> clip.close()
    
    展开全文
  • 玩转MoviePy - MoviePy合并视频

    千次阅读 2018-08-07 22:06:38
    玩转MoviePy - MoviePy合并视频 玩转MoviePy - MoviePy合并视频 from moviepy.video.VideoClip import TextClip, ImageClip from moviepy.video.compositing.concatenate import concatenate_videoclips ...

    玩转MoviePy - MoviePy合并视频

    from moviepy.video.VideoClip import TextClip, ImageClip
    from moviepy.video.compositing.concatenate import concatenate_videoclips
    from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
    
    video = concatenate_videoclips(unit_videos)
    video.write_videofile("%s.mp4" % title, fps=12, codec="mpeg4", remove_temp=False)
    

    版权声明:转载必须注明本文转自 East196 的博客:http://blog.csdn.net/east196

    展开全文
  • 安装moviepy

    2020-02-14 20:10:11
    安装moviepy pip install MoviePy 遇到的问题 pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out. 解决办法 可能是网络太慢的...
  • Shut up moviepy

    2021-01-06 07:06:24
    <div><p>When using wandb.Video, moviepy prints <pre><code> Moviepy - Writing video /tmp/tmpqt0fstd9wandb-media/nzsn7ktn.mp4 Moviepy - Done ! </code></pre> <p>It also prints the following warning (don&...
  • 回到目录 给MoviePy Logo做一个闪动的阴影效果 一起交流,一起进步,群内提问答疑 QQ群:MoviePy中文 :819718037 回到目录
  • 安装包由于MoviePy某些功能要用到requests,但是目前直接用pip安装MoviePy时并不会自动帮你安装这个依赖包,还需要自己安装requests。所以安装MoviePy需要两行。pip install MoviePypip instal...
  • moviepy使用教程

    千次阅读 2020-07-22 17:19:21
    moviepy使用教程一、剪辑成果二、遇到问题三、moviepy方法分享一、音频剪辑方法二、视频剪辑方法 一、剪辑成果 未来 二、遇到问题 尝试使用ffmpeg、moviepy、pydub,其中pydub主要是对音频的处理,moviepy对...
  • Moviepy and ImageIO

    2020-12-09 10:59:54
    - video readers via ImageIO and MoviePy , both packages have different implementations of an ffmpeg-based video reader via pipes - video exporter via moviepy, similar api as the PyAv exporter - tests ...
  •  下面的内容介绍以下MoviePy适用于何种场景以及MoviePy如何工作。 我需要使用MoviePy吗? 出于以下的情景或原因,我们可能会有使用Python做视频编辑的需求。 *我们有大量的视频需要处理,或者采用复杂的方式将...
  • 如何高效率使用MoviePy 接下来,这一节将会介绍许多全世界MoviePy开发者总结的开发经验。 开始学习使用MoviePy最好的方式是使用IPython Notebook:它可以让预览clip变得简单,有自动补全的功能,而且可以显示函数...
  • 目前使用moviepy的项目里各种问题接踵而至,第一批我只采集了1w个抖音短视频做视频合成,不得不说,moviepy还是不少缺陷的,最开始的大部分时候是ffmpeg引起的OOM,是我分配的内存不够,加大资源分配,每次运行完毕...
  • from moviepy.editor import *from moviepy.audio.fx import all# 字体名字不能含有中文FONT_URL = './font/heimi.TTF'def render(input_video, output_video="new_video.mp4"):# 剪个10s的720x1280px的视频...
  • 这个例子,一定能很好的地说明为什么大家有兴趣基于MoviePy脚本来实现一些特效,我们也可以想像一下如果是手工做的话,绝壁手抽筋了。   下面就是代码实现  import numpy as np from moviepy.editor import *...
  • MoviePy中的Audio 下面主要是演示在moviepy中如何创建和编辑audio clips。 之前曾经说过,在moviepy中,当我们剪切,混合,拼接video clip的时候,audio clip并不需要我们去操心,他会自动的随着video完成相应的...
  • MoviePy 安装 配置

    万次阅读 多人点赞 2018-05-01 17:01:34
    MoviePy 安装 配置 最近想用python剪辑、组合视频,发现了这样一个库,好像是15年才发布的库。挺好用的。但是中文资料几乎没有,终于有机会逼自己尝试一下英文文档了哈哈哈。 安装包 由于MoviePy某些功能要...
  • moviepy折磨

    2020-04-27 01:45:09
    用到了pyaudio和moviepy pyaudio在3.7的系统没有对应pip install 版本 不过conda里有,解决了。 moviepy直接装就是了 然后在转换文件的时候moviepy一直报错AttributeError: ‘NoneType’ object has no attribute '...
  • moviepy官网: https://pypi.org/project/moviepy/ 是一个用于视频编辑的Python库:切割、连接、标题插入、视频合成、非线性编辑,视频处理和定制效果的创建。 Github: https://github.com/Zulko/moviepy MoviePy ...
  • 回到目录 漂亮的结尾 ...from moviepy.video.tools.drawing import circle # 原有视频 clip = VideoFileClip("../../videos/badl-0006.mov", audio=False). subclip(26,31). ...
  • MoviePy问题解决汇总

    千次阅读 2018-11-23 13:40:05
    *前言:*本贴汇总网友在群里提出的各种使用MoviePy过程中用到的问题,并给出解决步骤。如果网友有其他问题,欢迎在评论区留言或者加群提问(QQ群:MoviePy中文 :819718037) 1.TextClip中文乱码问题与解决 返回...
  • 回到目录 字幕特效,部分隐藏 ...from moviepy.video.tools.credits import credits1 # 加载山背景的clip,截取,变慢,画面变暗 clip = (VideoFileClip('../../videos/badl-0001.mov', audio=False) ....
  • 本节收集提示和技巧,以帮助您充分利用更广阔的MoviePy的体验。从MoviePy开始的最佳方法是将其与IPython Notebook一起使用:它使预览剪辑(如本节所述)更加容易,具有自动补全功能并可以显示库的不同方法的文档。我...
  • moviepy草码

    2019-06-13 23:35:00
    第一下。 # coding=utf-8 from moviepy.editor ...from moviepy.video.tools.subtitles import SubtitlesClip generator = lambda txt: TextClip(txt, font='SimHei', fontsize=24, color='black') ...
  • 使用Docker镜像快速搭建moviepy环境 前言:之前有不少同学说搭建moviepy环境失败了,大部分是卡在ffmpeg自动下载的步骤了,原因在于从国外下载ffmpeg。当然有办法解决:可以手动下载,然后放在~/.imageio/ffmpeg...
  • 我正在使用moviepy模块.通过下面的代码,我可以逐步缩放剪辑,但是很难弄清楚如何将剪辑从小到大,以创建动画效果.您提供的任何反馈意见都将不胜感激.import osfrom moviepy.editor import *scre...
  • import moviepy 报错

    千次阅读 2017-08-14 16:39:00
    i was trying to create an application with Python using the moviepy library. I installed it using: pip install moviepy11 I found this from a MoviePy crash-course: Import everything needed ...
  • 回到目录 追踪人脸,打马赛克 首先,我们需要先追踪到人脸,即,获得两个函数fx和fy就像(fx(t), fy(t))获得某时刻t脸的中心的坐标,通过manual_tracking,这个功能很快就实现了。...from moviepy.video.t...
  • moviepy底层使用ffmpeg读取和导出视频以及音频文件。它使用ImageMagic对视频插入文字以及生成GIF(可选)。对于不同的媒体文件的处理是通过python高效的数值计算库numpy来完成的。一些特效处理等使用到了python的图像...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,194
精华内容 477
关键字:

moviepy