MoviePy是一个用于视频编辑的Python模块,它可被用于一些基本操作(如剪切、拼接、插入标题)、视频合成(即非线性编辑)、视频处理和创建高级特效。

K Kollmann 0f6f6d4d9b refactor: update, reformat .gitignore 4 月之前
.github e4c1a097bf refactor(workflows): code formatting and linting 4 月之前
docs 57c279a30f Implement basic data model (#1076) 1 年之前
examples f5a6fde762 style: fix code formatting (Black, flake8) 4 月之前
media a472c864d2 Take into account rotation metadata to define video size (#577) 3 年之前
moviepy f5a6fde762 style: fix code formatting (Black, flake8) 4 月之前
scripts 6c272d88da Fix Windows CI (#1841) 2 年之前
tests f5a6fde762 style: fix code formatting (Black, flake8) 4 月之前
.gitignore 0f6f6d4d9b refactor: update, reformat .gitignore 4 月之前
.pre-commit-config.yaml 551e265f8b Upgrade tooling (#1770) 2 年之前
.readthedocs.yml fd71ed12f1 Add support for ReadTheDocs (#1328) 4 年之前
CHANGELOG.md 858bb81fba Raise `ValueError` if invalid arguments passed to `TextClip` (#1842) 2 年之前
CONTRIBUTING.md b275eb5585 fix: in CONTRIBUTING.md, correct Gitter URL 5 月之前
Dockerfile c8d02deea7 Updated dockerfile to modify policy.xml in-place (#1304) 4 年之前
LICENCE.txt b074da58e7 Fix LICENCE.txt so that GitHub can auto-detect it 4 年之前
MANIFEST.in 023c8b3e0e Remove 'ez_setup.py' (#1433) 3 年之前
README.rst 77d7165da4 Fix GitHub workflow badge (#1914) 1 年之前
appveyor.yml 552e94b710 Add fake appveyor workflow file (#1691) 2 年之前
setup.cfg e4c1a097bf refactor(workflows): code formatting and linting 4 月之前
setup.py 86fd511fdb Fix CI. (#1943) 1 年之前

README.rst

MoviePy
=======

.. image:: https://badge.fury.io/py/moviepy.svg
:target: PyPI_
:alt: MoviePy page on the Python Package Index
.. image:: https://img.shields.io/gitter/room/movie-py/gitter?color=46BC99&logo=gitter
:target: Gitter_
:alt: Discuss MoviePy on Gitter
.. image:: https://img.shields.io/github/actions/workflow/status/Zulko/moviepy/test_suite.yml?logo=github
:target: https://github.com/Zulko/moviepy/actions/workflows/test_suite.yml
:alt: Build status on gh-actions
.. image:: https://img.shields.io/coveralls/github/Zulko/moviepy/master?logo=coveralls
:target: https://coveralls.io/github/Zulko/moviepy?branch=master
:alt: Code coverage from coveralls.io

MoviePy (full documentation_) is a Python library for video editing: cutting, concatenations, title insertions, video compositing (a.k.a. non-linear editing), video processing, and creation of custom effects. See the gallery_ for some examples of use.

MoviePy can read and write all the most common audio and video formats, including GIF, and runs on Windows/Mac/Linux, with Python 3.6+. Here it is in action in an IPython notebook:

.. image:: https://raw.githubusercontent.com/Zulko/moviepy/master/docs/demo_preview.jpeg
:alt: [logo]
:align: center

Example
-------

In this example we open a video file, select the subclip between t=50s and t=60s, add a title at the center of the screen, and write the result to a new file:

.. code:: python

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...

*Note:* This example uses the new 2.x API, for MoviePy 1.0.3, currently on PyPI, see `this snippet `_.


Maintainers wanted!
-------------------

As there are more and more people seeking support (270 open issues as of Jan. 2021!) and all the MoviePy maintainers seem busy, we'd love to hear about developers interested in giving a hand and solving some of the issues (especially the ones that affect you) or reviewing pull requests. Open an issue or contact us directly if you are interested. Thanks!

Installation
------------

MoviePy depends on the Python modules NumPy_, Imageio_, Decorator_, and Proglog_, which will be automatically installed during MoviePy's installation. The software FFMPEG should be automatically downloaded/installed (by imageio) during your first use of MoviePy (installation will take a few seconds). If you want to use a specific version of FFMPEG, follow the instructions in ``config_defaults.py``. In case of trouble, provide feedback.

**Installation by hand:** download the sources, either from PyPI_ or, if you want the development version, from GitHub_, unzip everything into one folder, open a terminal and type:

.. code:: bash

$ (sudo) python setup.py install

**Installation with pip:** if you have ``pip`` installed, just type this in a terminal:

.. code:: bash

$ (sudo) pip install moviepy

If you have neither ``setuptools`` nor ``ez_setup`` installed, the command above will fail. In this case type this before installing:

.. code:: bash

$ (sudo) pip install setuptools


Optional but useful dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can install ``moviepy`` with all dependencies via:

.. code:: bash

$ (sudo) pip install moviepy[optional]

ImageMagick_ is not strictly required, but needed if you want to incorporate texts. It can also be used as a backend for GIFs, though you can also create GIFs with MoviePy without ImageMagick.

Once you have installed ImageMagick, MoviePy will try to autodetect the path to its executable. If it fails, you can still configure it by setting environment variables (see the documentation).

PyGame_ is needed for video and sound previews (not relevant if you intend to work with MoviePy on a server but essential for advanced video editing by hand).

For advanced image processing, you will need one or several of the following packages:

- The Python Imaging Library (PIL) or, even better, its branch Pillow_.
- Scipy_ (for tracking, segmenting, etc.) can be used to resize video clips if PIL and OpenCV are not installed.
- `Scikit Image`_ may be needed for some advanced image manipulation.
- `OpenCV 2.4.6`_ or a more recent version (one that provides the package ``cv2``) may be needed for some advanced image manipulation.
- `Matplotlib`_

For instance, using the method ``clip.resize`` requires that at least one of Scipy, PIL, Pillow or OpenCV is installed.


Documentation
-------------

Building the documentation has additional dependencies that require installation.

.. code:: bash

$ (sudo) pip install moviepy[doc]

The documentation can be generated and viewed via:

.. code:: bash

$ python setup.py build_docs

You can pass additional arguments to the documentation build, such as clean build:

.. code:: bash

$ python setup.py build_docs -E

More information is available from the `Sphinx`_ documentation.

New in 1.0.0: Progress bars and messages with Proglog
-------------------------------------------------------

Non-backwards-compatible changes were introduced in 1.0.0 to
manage progress bars and messages using
`Proglog `_, which
enables to display nice progress bars in the console as well as in
a Jupyter notebook or any user interface, like a website.

To display notebook friendly progress bars, first install IPyWidgets:

.. code::

sudo pip install ipywidgets
sudo jupyter nbextension enable --py --sys-prefix widgetsnbextension

Then at the beginning of your notebook enter:

.. code:: python

import proglog
proglog.notebook()

Have a look at the Proglog project page for more options.

Contribute
----------

MoviePy is open-source software originally written by Zulko_ and released under the MIT licence. The project is hosted on GitHub_, where everyone is welcome to contribute, ask for help or simply give feedback. Please read our `Contributing Guidelines`_ for more information about how to contribute!

You can also discuss the project on Reddit_ or Gitter_. These are preferred over GitHub issues for usage questions and examples.


Maintainers
-----------

- Zulko_ (owner)
- `@tburrows13`_
- `@mgaitan`_
- `@earney`_
- `@mbeacom`_
- `@overdrivr`_
- `@keikoro`_
- `@ryanfox`_
- `@mondeja`_


.. MoviePy links
.. _gallery: https://zulko.github.io/moviepy/gallery.html
.. _documentation: https://zulko.github.io/moviepy/
.. _`download MoviePy`: https://github.com/Zulko/moviepy
.. _`Label Wiki`: https://github.com/Zulko/moviepy/wiki/Label-Wiki
.. _Contributing Guidelines: https://github.com/Zulko/moviepy/blob/master/CONTRIBUTING.md

.. Websites, Platforms
.. _Reddit: https://www.reddit.com/r/moviepy/
.. _PyPI: https://pypi.python.org/pypi/moviepy
.. _GitHub: https://github.com/Zulko/moviepy
.. _Gitter: https://gitter.im/movie-py/Lobby

.. Software, Tools, Libraries
.. _Pillow: https://pillow.readthedocs.org/en/latest/
.. _Scipy: https://www.scipy.org/
.. _`OpenCV 2.4.6`: https://github.com/skvark/opencv-python
.. _Pygame: https://www.pygame.org/download.shtml
.. _Numpy: https://www.scipy.org/install.html
.. _imageio: https://imageio.github.io/
.. _`Scikit Image`: https://scikit-image.org/docs/stable/install.html
.. _Decorator: https://pypi.python.org/pypi/decorator
.. _proglog: https://github.com/Edinburgh-Genome-Foundry/Proglog
.. _ffmpeg: https://www.ffmpeg.org/download.html
.. _ImageMagick: https://www.imagemagick.org/script/index.php
.. _`Matplotlib`: https://matplotlib.org/
.. _`Sphinx`: https://www.sphinx-doc.org/en/master/setuptools.html

.. People
.. _Zulko: https://github.com/Zulko
.. _`@mgaitan`: https://github.com/mgaitan
.. _`@tburrows13`: https://github.com/tburrows13
.. _`@earney`: https://github.com/earney
.. _`@mbeacom`: https://github.com/mbeacom
.. _`@overdrivr`: https://github.com/overdrivr
.. _`@keikoro`: https://github.com/keikoro
.. _`@ryanfox`: https://github.com/ryanfox
.. _`@mondeja`: https://github.com/mondeja