实例介绍
MoviePy是一个用于视频编辑的Python库,支持剪切、拼接、插入标题、视频合成(非线性编辑)、视频处理和自定义效果的创建。它可以读取和写入所有常见的音频和视频格式,包括GIF,适用于Windows/Mac/Linux,并支持Python 3.6 。在这个示例中,我们打开一个视频文件,选择t=50s到t=60s之间的子剪辑,在屏幕中央添加一个标题,并将结果写入新文件:
from moviepy 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') .with_position('center') .with_duration(10) ) result = CompositeVideoClip([video, txt_clip]) # Overlay text on video result.write_videofile("myHolidays_edited.webm",fps=25) # Many options...
注意:此示例使用新的2.x API,对于目前在PyPI上的MoviePy 1.0.3,请参阅此片段。
【实例截图】
文件清单
└── moviepy-0f6f6d4d9b96c69d109975549fe6293931f1a19d
├── appveyor.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── Dockerfile
├── docs
│ ├── advanced_tools
│ │ ├── advanced_tools.py
│ │ └── advanced_tools.rst
│ ├── conf.py
│ ├── demo_preview.jpeg
│ ├── docker.rst
│ ├── examples
│ │ ├── compo_from_image.jpeg
│ │ ├── compo_from_image.rst
│ │ ├── dancing_knights.rst
│ │ ├── examples.rst
│ │ ├── example_with_sound.rst
│ │ ├── headblur.rst
│ │ ├── logo.rst
│ │ ├── masked_credits.rst
│ │ ├── moving_letters.rst
│ │ ├── painting_effect.rst
│ │ ├── quick_recipes.rst
│ │ ├── several_characters.rst
│ │ ├── star_worms.rst
│ │ ├── the_end.rst
│ │ └── ukulele_concerto.rst
│ ├── FAQ.rst
│ ├── gallery.rst
│ ├── getting_started
│ │ ├── audioclips.rst
│ │ ├── circle.gif
│ │ ├── compositing.rst
│ │ ├── effects.rst
│ │ ├── efficient_moviepy.rst
│ │ ├── explanations.jpeg
│ │ ├── getting_started.rst
│ │ ├── ipynb_example.jpeg
│ │ ├── quick_presentation.rst
│ │ ├── stacked.jpeg
│ │ ├── videoclips.rst
│ │ ├── videoWH.jpeg
│ │ └── working_with_matplotlib.rst
│ ├── index.rst
│ ├── install.rst
│ ├── logo.png
│ ├── make.bat
│ ├── Makefile
│ ├── makehtml.sh
│ ├── ref
│ │ ├── AudioClip.rst
│ │ ├── audiofx
│ │ │ ├── moviepy.audio.fx.all.audio_delay.rst
│ │ │ ├── moviepy.audio.fx.all.audio_fadein.rst
│ │ │ ├── moviepy.audio.fx.all.audio_fadeout.rst
│ │ │ ├── moviepy.audio.fx.all.audio_normalize.rst
│ │ │ ├── moviepy.audio.fx.all.multiply_stereo_volume.rst
│ │ │ ├── moviepy.audio.fx.all.multiply_volume.rst
│ │ │ └── moviepy.audio.fx.all.volumex.rst
│ │ ├── audiofx.rst
│ │ ├── audiotools.rst
│ │ ├── bideotools_gradient.jpeg
│ │ ├── Clip.rst
│ │ ├── code_origanization.rst
│ │ ├── decorators.rst
│ │ ├── ffmpeg.rst
│ │ ├── ref.rst
│ │ ├── VideoClip
│ │ │ └── VideoClip.rst
│ │ ├── videofx
│ │ │ ├── moviepy.video.fx.all.accel_decel.rst
│ │ │ ├── moviepy.video.fx.all.blackwhite.rst
│ │ │ ├── moviepy.video.fx.all.blink.rst
│ │ │ ├── moviepy.video.fx.all.crop.rst
│ │ │ ├── moviepy.video.fx.all.even_size.rst
│ │ │ ├── moviepy.video.fx.all.fadein.rst
│ │ │ ├── moviepy.video.fx.all.fadeout.rst
│ │ │ ├── moviepy.video.fx.all.freeze_region.rst
│ │ │ ├── moviepy.video.fx.all.freeze.rst
│ │ │ ├── moviepy.video.fx.all.gamma_corr.rst
│ │ │ ├── moviepy.video.fx.all.headblur.rst
│ │ │ ├── moviepy.video.fx.all.invert_colors.rst
│ │ │ ├── moviepy.video.fx.all.loop.rst
│ │ │ ├── moviepy.video.fx.all.lum_contrast.rst
│ │ │ ├── moviepy.video.fx.all.make_loopable.rst
│ │ │ ├── moviepy.video.fx.all.margin.rst
│ │ │ ├── moviepy.video.fx.all.mask_and.rst
│ │ │ ├── moviepy.video.fx.all.mask_color.rst
│ │ │ ├── moviepy.video.fx.all.mask_or.rst
│ │ │ ├── moviepy.video.fx.all.mirror_x.rst
│ │ │ ├── moviepy.video.fx.all.mirror_y.rst
│ │ │ ├── moviepy.video.fx.all.multiply_color.rst
│ │ │ ├── moviepy.video.fx.all.multiply_speed.rst
│ │ │ ├── moviepy.video.fx.all.painting.rst
│ │ │ ├── moviepy.video.fx.all.resize.rst
│ │ │ ├── moviepy.video.fx.all.rotate.rst
│ │ │ ├── moviepy.video.fx.all.scroll.rst
│ │ │ ├── moviepy.video.fx.all.supersample.rst
│ │ │ ├── moviepy.video.fx.all.time_mirror.rst
│ │ │ └── moviepy.video.fx.all.time_symmetrize.rst
│ │ ├── videofx.rst
│ │ ├── videotools_credits.jpeg
│ │ └── videotools.rst
│ ├── _static
│ │ ├── accel_decel-fx-params.png
│ │ ├── logo.png
│ │ ├── logo_small.jpeg
│ │ └── moviepy.css
│ └── _themes
├── examples
│ ├── compo_from_image.py
│ ├── dancing_knights.py
│ ├── example_with_sound.py
│ ├── headblur.py
│ ├── logo.py
│ ├── masked_credits.py
│ ├── moving_letters.py
│ ├── painting_effect.py
│ ├── README.rst
│ ├── soundtrack.py
│ ├── star_worms.py
│ ├── the_end.py
│ └── ukulele_concerto.py
├── LICENCE.txt
├── MANIFEST.in
├── media
│ ├── afterimage.png
│ ├── big_buck_bunny_0_30.webm
│ ├── big_buck_bunny_432_433.webm
│ ├── bitmap.mp4
│ ├── chaplin.mp4
│ ├── crunching.mp3
│ ├── fire2.mp4
│ ├── matplotlib_demo1.png
│ ├── pigs_in_a_polka.gif
│ ├── python_logo.png
│ ├── python_logo_upside_down.png
│ ├── rotated-90-degrees.mp4
│ ├── sintel_with_14_chapters.mp4
│ ├── subtitles.srt
│ ├── subtitles-unicode.srt
│ ├── test_video.mp4
│ ├── traj.txt
│ ├── vacation_2017.jpg
│ ├── video_with_failing_audio.mp4
│ └── with-attached-pic.mp3
├── moviepy
│ ├── audio
│ │ ├── AudioClip.py
│ │ ├── fx
│ │ │ ├── all
│ │ │ │ └── __init__.py
│ │ │ ├── audio_delay.py
│ │ │ ├── audio_fadein.py
│ │ │ ├── audio_fadeout.py
│ │ │ ├── audio_loop.py
│ │ │ ├── audio_normalize.py
│ │ │ ├── __init__.py
│ │ │ ├── multiply_stereo_volume.py
│ │ │ └── multiply_volume.py
│ │ ├── __init__.py
│ │ ├── io
│ │ │ ├── AudioFileClip.py
│ │ │ ├── ffmpeg_audiowriter.py
│ │ │ ├── __init__.py
│ │ │ ├── preview.py
│ │ │ └── readers.py
│ │ └── tools
│ │ ├── cuts.py
│ │ └── __init__.py
│ ├── Clip.py
│ ├── config.py
│ ├── decorators.py
│ ├── editor.py
│ ├── __init__.py
│ ├── tools.py
│ ├── utils.py
│ ├── version.py
│ └── video
│ ├── compositing
│ │ ├── CompositeVideoClip.py
│ │ ├── concatenate.py
│ │ ├── __init__.py
│ │ └── transitions.py
│ ├── fx
│ │ ├── accel_decel.py
│ │ ├── all
│ │ │ └── __init__.py
│ │ ├── blackwhite.py
│ │ ├── blink.py
│ │ ├── crop.py
│ │ ├── even_size.py
│ │ ├── fadein.py
│ │ ├── fadeout.py
│ │ ├── freeze.py
│ │ ├── freeze_region.py
│ │ ├── gamma_corr.py
│ │ ├── headblur.py
│ │ ├── __init__.py
│ │ ├── invert_colors.py
│ │ ├── loop.py
│ │ ├── lum_contrast.py
│ │ ├── make_loopable.py
│ │ ├── margin.py
│ │ ├── mask_and.py
│ │ ├── mask_color.py
│ │ ├── mask_or.py
│ │ ├── mirror_x.py
│ │ ├── mirror_y.py
│ │ ├── multiply_color.py
│ │ ├── multiply_speed.py
│ │ ├── painting.py
│ │ ├── resize.py
│ │ ├── rotate.py
│ │ ├── scroll.py
│ │ ├── supersample.py
│ │ ├── time_mirror.py
│ │ └── time_symmetrize.py
│ ├── __init__.py
│ ├── io
│ │ ├── bindings.py
│ │ ├── downloader.py
│ │ ├── ffmpeg_reader.py
│ │ ├── ffmpeg_tools.py
│ │ ├── ffmpeg_writer.py
│ │ ├── gif_writers.py
│ │ ├── html_tools.py
│ │ ├── ImageSequenceClip.py
│ │ ├── __init__.py
│ │ ├── preview.py
│ │ ├── sliders.py
│ │ └── VideoFileClip.py
│ ├── tools
│ │ ├── credits.py
│ │ ├── cuts.py
│ │ ├── drawing.py
│ │ ├── __init__.py
│ │ ├── interpolators.py
│ │ ├── segmenting.py
│ │ ├── subtitles.py
│ │ └── tracking.py
│ └── VideoClip.py
├── README.rst
├── scripts
│ └── get-latest-imagemagick-win.py
├── setup.cfg
├── setup.py
└── tests
├── conftest.py
├── __init__.py
├── README.rst
├── test_AudioClips.py
├── test_BitmapClip.py
├── test_Clip.py
├── test_compositing.py
├── test_editor.py
├── test_examples.py
├── test_ffmpeg_reader.py
├── test_ffmpeg_tools.py
├── test_ffmpeg_writer.py
├── test_fx.py
├── test_ImageSequenceClip.py
├── test_issues.py
├── test_PR.py
├── test_SubtitlesClip.py
├── test_TextClip.py
├── test_tools.py
├── test_VideoClip.py
├── test_VideoFileClip.py
└── test_videotools.py
27 directories, 244 files
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论