Video editing with Python
added version and many automatically generated doc files
Zulkoaa5f246c8616
diff --git a/README.rst b/README.rstindex 963d1a81..769cab4a 100644--- a/README.rst+++ b/README.rst@@ -1,12 +1,9 @@MoviePy========-MoviePy is a Python module for script-based movie editing, which enables-basic operations (cuts, concatenations, title insertions) to be done-in a few lines. It can also be used for advanced compositing.--See the full documentation and demo videos here_, or have a look at this page of `animated GIFs made with MoviePy <http://zulko.github.io/blog/2014/01/23/making-animated-gifs-from-video-files-with-python/>`_.+MoviePy (full documentation here_) is a Python module for script-based movie editing.+It can read and write to many formats, `including animated GIFs <http://zulko.github.io/blog/2014/01/23/making-animated-gifs-from-video-files-with-python/>`_, and enables basic operations (cuts, concatenations, title insertions) to be done in a few lines. It can also be used for advanced compositing.A typical MoviePy script looks like that: ::@@ -27,116 +24,33 @@ A typical MoviePy script looks like that: ::-Contribute !--------------MoviePy is an open-source software originally written by Zulko_ and released under the MIT licence.-The project is hosted on Github_ and everyone is welcome to contribute ! Please give feedback if you are using it and encounter difficulties.-+The project is hosted on Github_ , where everyone is welcome to contribute and give feedback.Download and Installation---------------------------+MoviePy requires the Python modules Numpy_, Decorator_, and tqdm_. All of these will all be automatically installed during MoviePy's installation.+You will also need a **recent version** of the software ffmpeg_ , preferably downloaded directly from the ffmpeg website.+If you intend to use advanced features you will also need a few other dependencies like ImageMagick_ , Pygame_ etc. (see `the docs <http://zulko.github.io/moviepy/install.html>`_).-Dependencies-~~~~~~~~~~~~~--MoviePy cannot run without these dependencies:--- The software ffmpeg_ is needed for writing, reading, converting the sound and the video.-- `Numpy`_ is needed for image and sound manipulation.-- The Decorator_ module is used in the MoviePy code for better code readability.--**Make sure to use a recent version of ffmpeg**.-You can either install it or save the binary files in any folder and specify the path to these folders before installing MoviePy (for the latter, see `Manual installation`_ below).--**Debian and Ubuntu users**, you certainly have an out-of-date version of ffmpeg, you *must* download a recent version from the ffmpeg_ website.--Normally Numpy and Decorator will be automatically installed when you install MoviePy. In case of doubt/problem they can also be installed manually.-Numpy can be installed with most software managers on Linux distributions. Both Numpy and Decorator can be installed as follows with pip: ::-- (sudo) pip install decorator- (sudo) pip install numpy----(Not so) Optional dependencies-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--You are not obliged to install these but for many uses MoviePy will scream at you and say that the package or the software is missing. All these dependencies can be installed any time after the installation of MoviePy.--- PyGame_ is needed for video and sound previews (really essential for advanced editing).-- imageMagick_ is needed for all text generation, GIF support, and much more in the future.--There are many packages for image manipulation/processing in python. Most effects are coded such that none of these packages are needed, or such that having at least one of these packages is sufficient. For instance, the feature ``clip.resize`` will be available if you have either Scikit Image *or* the PIL *or* OpenCV installed (PIL or OpenCV are to be prefered).--- Scipy is needed for many advanced functionalities (tracking, segmenting, etc.)-- `Scikit Image`_ may be needed for some advanced image manipulation.-- The Python Imaging Library can be used for resizing videos.-- `OpenCV 2.4.6`_ (which provides the python package ``cv2``) or more recent may be needed for some advanced image manipulation. See below for the installation of OpenCV.--If you are on linux, these will surely be in your repos.+Installation+----------------Installation with PIP-~~~~~~~~~~~~~~~~~~~~~~~~~~--On Linux, if you have pip installed, just type this in a terminal ::-- sudo pip install moviepy--Maybe it works with easy_install too, but it hasn't been fully tested yet.----.. _manual_install:---Manual installation-~~~~~~~~~~~~~~~~~~~~~~~~~~--You can install moviepy manually by downloading the sources, either on PYPI_ or (if you want the development version) on Github_ .--Then just unzip everything in one folder, open a terminal and type ::+First method : if you have ``pip`` installed, just type this in a terminal (sudo is optional on some systems) ::- sudo python setup.py install+ (sudo) pip install moviepy-Before doing that, you should make sure that MoviePy can locate ffmpeg on your computer. To do that, run the script ``moviepy/conf.py``. It it fails, then you must enter the path in the first line of this file ::+Second method : by hand. Download the sources, either on PyPI_ or (if you want the development version) on Github_, unzip everything in one folder, open a terminal and type ::- FFMPEG_BINARY = path/to/your/ffmpeg--Installing OpenCV 2.4.6-~~~~~~~~~~~~~~~~~~~~~~~~~~~~--OpenCV is very optional, its installation is not always simple and I found it to be unstable, be warned. The installation seems easy for Windows. On linux, here is what I found on the Internet:--- Remove any other version of OpenCV if you installed it through a package manager.-- Unzip the source code of `OpenCV 2.4.6`_ in some folder. open a terminal in this folder.-- Make a new directory and go into this directory: ::-- mkdir release- cd release--- Run ``cmake``. Here is the line I used: ::-- cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..--- Run ``make``. This may take a few minutes (15 minutes on my computer). ::-- make--- Finally, install. ::-- sudo make install--And voilà !--You can check if it worked by opeing a Python console and typing ::+ (sudo) python setup.py install- import cv2- print cv2.__version__+Linking to ffmpeg+~~~~~~~~~~~~~~~~~~-Advice: do not throw your ``release`` folder away. If later you have strange bugs with OpenCV involving ``.so`` files, just redo the ``sudo make install`` step.+If you put have a ffmpeg binary in you executable folder (on Linux it will be ``/usr/bin``) it will be detected automatically by MoviePy. Else make sure that MoviePy can locate ffmpeg on your computer by running the script ``moviepy/conf.py`` that is in the sources. It it fails, then you must enter the path to the FFMPEG executable in the first line of this file ::+ FFMPEG_BINARY = path/to/your/ffmpeg@@ -153,4 +67,4 @@ Advice: do not throw your ``release`` folder away. If later you have strange bug.. _ffmpeg: http://www.ffmpeg.org/download.html-.. _imageMagick: http://www.imagemagick.org/script/index.php+.. _ImageMagick: http://www.imagemagick.org/script/index.phpdiff --git a/docs/Makefile b/docs/Makefileindex c077a760..a1f83541 100644--- a/docs/Makefile+++ b/docs/Makefile@@ -2,7 +2,7 @@## You can set these variables from the command line.-SPHINXOPTS =+SPHINXOPTS = -ESPHINXBUILD = sphinx-buildPAPER =BUILDDIR = ../../docsdiff --git a/docs/conf.py b/docs/conf.pyindex 8685a91c..98480948 100644--- a/docs/conf.py+++ b/docs/conf.py@@ -26,7 +26,11 @@ import sys, os# Add any Sphinx extension module names here, as strings. They can be extensions# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo',- 'sphinx.ext.viewcode', 'numpydoc', 'sphinx.ext.autosummary']+ 'sphinx.ext.viewcode', 'sphinx.ext.autosummary','numpydoc']++numpydoc_class_members_toctree= False+numpydoc_show_class_members= False+autosummary_generate= True# Add any paths that contain templates here, relative to this directory.templates_path = ['_templates']diff --git a/docs/crash_course/explanations.jpeg b/docs/crash_course/explanations.jpegnew file mode 100644index 00000000..cd71e587Binary files /dev/null and b/docs/crash_course/explanations.jpeg differdiff --git a/docs/examples/logo.rst b/docs/examples/logo.rstindex 270cdc9c..1ee4c5fe 100644--- a/docs/examples/logo.rst+++ b/docs/examples/logo.rst@@ -15,19 +15,4 @@ MoviePy logo with a moving shadowHere the logo is a picture, while the shadow is actually a black rectangle taking the whole screen, overlaid over the logo, but with a moving mask composed of a bi-gradient, such that only one (moving) part of the rectangle is visible. See :ref:`gradients` for the code of the function `biGradient`: ::- def f(t,size,duration, a = np.pi/3, thickness = 20):- w,h = size- v = thickness* np.array([np.cos(a),np.sin(a)])[::-1]- center = [int(t*w/duration),h/2]- return biGradientScreen(size,center,v,0.6,0.0)- w,h = moviesize = (720,380)- im = ImageClip("./logo_descr.png", transparent=True)- im = im.resize(width=w/2)-- duration = 1- shade = ColorClip(moviesize,col=(0,0,0)).with_mask()- shade.mask.get_frame = lambda t : f(t,moviesize,duration)- cc = CompositeVideoClip(moviesize,[im.set_pos(2*["center"]),shade])-- cc.subclip(0,duration).to_videofile("moviepy_logo.avi",fps=24)diff --git a/docs/examples/the_end.rst b/docs/examples/the_end.rstindex 8308c773..ef129b20 100644--- a/docs/examples/the_end.rst+++ b/docs/examples/the_end.rst@@ -21,4 +21,4 @@ that circle is so large that you see all the actual movie and you don't seethe "The End" clip. Then the circle becomes progressively smaller and as aconsequence you see less of the actual movie and more of the "The End" clip.-../../examples/the_end.py+.. literalinclude:: ../../examples/the_end.pydiff --git a/docs/index.rst b/docs/index.rstindex a1cd7e7a..98fa014a 100644--- a/docs/index.rst+++ b/docs/index.rst@@ -1,7 +1,9 @@MoviePy=======-MoviePy is a Python module for script-based movie editing. It enables basic operations (cuts, concatenations, title insertions) to be done in a few lines, and can be used for advanced compositing and special effects. It can read and save to many formats, including `animated GIFs <http://zulko.github.io/blog/2014/01/23/making-animated-gifs-from-video-files-with-python>`_.+MoviePy is a Python module for script-based movie editing. It enables basic operations (cuts, concatenations, title insertions) to be done in a few lines, and can be used for advanced compositing and special effects.++It can read and write to many formats, `including animated GIFs <http://zulko.github.io/blog/2014/01/23/making-animated-gifs-from-video-files-with-python>`_.Let us put together a few demonstration clips (you will find the code for most of these in the :ref:`examples`): ::@@ -58,10 +60,6 @@ User's Guideref/ref-.. raw:: html---.. _PyPI: https://pypi.python.org/pypi/moviepy.. _Github: https://github.com/Zulko/moviepy.. _Zulko: https://github.com/Zulko/diff --git a/docs/install.rst b/docs/install.rstindex d64dded1..e299b025 100644--- a/docs/install.rst+++ b/docs/install.rst@@ -15,7 +15,7 @@ First method : if you have ``pip`` installed, just type this in a terminal (sudo(sudo) pip install moviepy-Second method : by hand. Download the sources, either on PYPI_ or (if you want the development version) on Github_, unzip everything in one folder, open a terminal and type ::+Second method : by hand. Download the sources, either on PyPI_ or (if you want the development version) on Github_, unzip everything in one folder, open a terminal and type ::(sudo) python setup.py install@@ -95,6 +95,7 @@ Advice: do not throw your ``release`` folder away. If later you have strange bug.. _`Scikit Image`: http://scikit-image.org/download.html.. _Github: https://github.com/Zulko/moviepy+.. _PyPI: https://pypi.python.org/pypi/moviepy.. _`OpenCV 2.4.6`: http://sourceforge.net/projects/opencvlibrary/files/diff --git a/docs/ref/VideoClip.rst b/docs/ref/VideoClip/VideoClip.rstsimilarity index 83%rename from docs/ref/VideoClip.rstrename to docs/ref/VideoClip/VideoClip.rstindex 061cea7d..7555e9b0 100644--- a/docs/ref/VideoClip.rst+++ b/docs/ref/VideoClip/VideoClip.rst@@ -1,22 +1,28 @@.. ref_VideoClip:-************-VideoClip-************+***********************+ Classes of Video Clips+***********************+-.. currentmodule:: moviepy:class:`VideoClip`==========================.. autoclass:: moviepy.video.VideoClip.VideoClip+ :members::show-inheritance:++:class:`VideoFileClip`------------------------.. autoclass:: moviepy.video.io.VideoFileClip.VideoFileClip+ :members::show-inheritance:++:class:`ImageClip`----------------------@@ -24,6 +30,8 @@ VideoClip.. autoclass:: moviepy.video.VideoClip.ImageClip:members::show-inheritance:++:class:`ColorClip`------------------@@ -39,15 +47,13 @@ VideoClip.. autoclass:: moviepy.video.VideoClip.TextClip:members::show-inheritance:-+++:class:`CompositeVideoClip`-------------------------------.. autoclass:: moviepy.video.compositing.CompositeVideoClip.CompositeVideoClip:members::show-inheritance:--Useful Methods----------------.. automodule:: moviepy.video.compositing.concatenate.concatenatediff --git a/docs/ref/ffmpeg.rst b/docs/ref/ffmpeg.rstindex df2edfac..ff6a102c 100644--- a/docs/ref/ffmpeg.rst+++ b/docs/ref/ffmpeg.rst@@ -3,7 +3,7 @@FFMPEG tools-----------------------------.. automodule:: moviepy.video.io.ffmpeg+.. automodule:: moviepy.video.io.ffmpeg_tools:members::undoc-members::show-inheritance:diff --git a/docs/ref/ref.rst b/docs/ref/ref.rstindex e736e56d..4d846187 100644--- a/docs/ref/ref.rst+++ b/docs/ref/ref.rst@@ -7,7 +7,7 @@ The documentation may be a little messy for the moment, it will get better with:maxdepth: 3Clip- VideoClip+ VideoClip/VideoClipAudioClipvideofxaudiofxdiff --git a/docs/ref/videofx.rst b/docs/ref/videofx.rstindex 20e7d14b..d858de35 100644--- a/docs/ref/videofx.rst+++ b/docs/ref/videofx.rst@@ -1,11 +1,44 @@.. ref_videofx:-************-video.fx-************-This module regroups functions meant to be used with ``videoclip.fx``. When you type ``from moviepy import *``, the module ``video.fx`` is loaded as ``vfx`` and you can use ``vfx.colorx``, ``vfx.resize``, etc.+***********************+moviepy.video.fx (vfx)+***********************+The module ``moviepy.video.fx`` regroups functions meant to be used with ``videoclip.fx``. When you type ::++ from moviepy.editor import *+the module ``video.fx`` is loaded as ``vfx`` and you can use ``vfx.colorx``, ``vfx.resize``, etc.-.. automodule:: moviepy.video.fx- :members:- :show-inheritance:++.. currentmodule:: moviepy.video.fx++.. autosummary::+ :toctree: videofx+ :nosignatures:++ blackwhite+ blink+ colorx+ crop+ fadein+ fadeout+ freeze_at_end+ freeze_at_start+ gamma_corr+ headblur+ loop+ lum_contrast+ make_loopable+ margin+ mirror_x+ mirror_y+ painting+ resize+ rotation+ scroll+ speedx+ time_mirror+ time_symetrize+++diff --git a/docs/ref/videofx/moviepy.video.fx.blackwhite.rst b/docs/ref/videofx/moviepy.video.fx.blackwhite.rstnew file mode 100644index 00000000..e8f10b08--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.blackwhite.rst@@ -0,0 +1,6 @@+moviepy.video.fx.blackwhite+===========================++.. currentmodule:: moviepy.video.fx++.. autofunction:: blackwhite\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.blink.rst b/docs/ref/videofx/moviepy.video.fx.blink.rstnew file mode 100644index 00000000..5fd8ac8a--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.blink.rst@@ -0,0 +1,6 @@+moviepy.video.fx.blink+======================++.. currentmodule:: moviepy.video.fx++.. autofunction:: blink\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.colorx.rst b/docs/ref/videofx/moviepy.video.fx.colorx.rstnew file mode 100644index 00000000..f6d4a82b--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.colorx.rst@@ -0,0 +1,6 @@+moviepy.video.fx.colorx+=======================++.. currentmodule:: moviepy.video.fx++.. autofunction:: colorx\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.crop.rst b/docs/ref/videofx/moviepy.video.fx.crop.rstnew file mode 100644index 00000000..fff5c722--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.crop.rst@@ -0,0 +1,6 @@+moviepy.video.fx.crop+=====================++.. currentmodule:: moviepy.video.fx++.. autofunction:: crop\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.fadein.rst b/docs/ref/videofx/moviepy.video.fx.fadein.rstnew file mode 100644index 00000000..15a632c4--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.fadein.rst@@ -0,0 +1,6 @@+moviepy.video.fx.fadein+=======================++.. currentmodule:: moviepy.video.fx++.. autofunction:: fadein\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.fadeout.rst b/docs/ref/videofx/moviepy.video.fx.fadeout.rstnew file mode 100644index 00000000..4295baf7--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.fadeout.rst@@ -0,0 +1,6 @@+moviepy.video.fx.fadeout+========================++.. currentmodule:: moviepy.video.fx++.. autofunction:: fadeout\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.freeze_at_end.rst b/docs/ref/videofx/moviepy.video.fx.freeze_at_end.rstnew file mode 100644index 00000000..2e2172e5--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.freeze_at_end.rst@@ -0,0 +1,6 @@+moviepy.video.fx.freeze_at_end+==============================++.. currentmodule:: moviepy.video.fx++.. autofunction:: freeze_at_end\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.freeze_at_start.rst b/docs/ref/videofx/moviepy.video.fx.freeze_at_start.rstnew file mode 100644index 00000000..e35aeb04--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.freeze_at_start.rst@@ -0,0 +1,6 @@+moviepy.video.fx.freeze_at_start+================================++.. currentmodule:: moviepy.video.fx++.. autofunction:: freeze_at_start\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.gamma_corr.rst b/docs/ref/videofx/moviepy.video.fx.gamma_corr.rstnew file mode 100644index 00000000..b63dd228--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.gamma_corr.rst@@ -0,0 +1,6 @@+moviepy.video.fx.gamma_corr+===========================++.. currentmodule:: moviepy.video.fx++.. autofunction:: gamma_corr\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.headblur.rst b/docs/ref/videofx/moviepy.video.fx.headblur.rstnew file mode 100644index 00000000..615111a8--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.headblur.rst@@ -0,0 +1,6 @@+moviepy.video.fx.headblur+=========================++.. currentmodule:: moviepy.video.fx++.. autofunction:: headblur\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.loop.rst b/docs/ref/videofx/moviepy.video.fx.loop.rstnew file mode 100644index 00000000..b7d6c565--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.loop.rst@@ -0,0 +1,6 @@+moviepy.video.fx.loop+=====================++.. currentmodule:: moviepy.video.fx++.. autofunction:: loop\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.lum_contrast.rst b/docs/ref/videofx/moviepy.video.fx.lum_contrast.rstnew file mode 100644index 00000000..f5d7b289--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.lum_contrast.rst@@ -0,0 +1,6 @@+moviepy.video.fx.lum_contrast+=============================++.. currentmodule:: moviepy.video.fx++.. autofunction:: lum_contrast\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.make_loopable.rst b/docs/ref/videofx/moviepy.video.fx.make_loopable.rstnew file mode 100644index 00000000..2d92922d--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.make_loopable.rst@@ -0,0 +1,6 @@+moviepy.video.fx.make_loopable+==============================++.. currentmodule:: moviepy.video.fx++.. autofunction:: make_loopable\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.margin.rst b/docs/ref/videofx/moviepy.video.fx.margin.rstnew file mode 100644index 00000000..3d59c310--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.margin.rst@@ -0,0 +1,6 @@+moviepy.video.fx.margin+=======================++.. currentmodule:: moviepy.video.fx++.. autofunction:: margin\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.mirror_x.rst b/docs/ref/videofx/moviepy.video.fx.mirror_x.rstnew file mode 100644index 00000000..46af9323--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.mirror_x.rst@@ -0,0 +1,6 @@+moviepy.video.fx.mirror_x+=========================++.. currentmodule:: moviepy.video.fx++.. autofunction:: mirror_x\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.mirror_y.rst b/docs/ref/videofx/moviepy.video.fx.mirror_y.rstnew file mode 100644index 00000000..f7b80ed7--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.mirror_y.rst@@ -0,0 +1,6 @@+moviepy.video.fx.mirror_y+=========================++.. currentmodule:: moviepy.video.fx++.. autofunction:: mirror_y\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.painting.rst b/docs/ref/videofx/moviepy.video.fx.painting.rstnew file mode 100644index 00000000..4713d765--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.painting.rst@@ -0,0 +1,6 @@+moviepy.video.fx.painting+=========================++.. currentmodule:: moviepy.video.fx++.. autofunction:: painting\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.resize.rst b/docs/ref/videofx/moviepy.video.fx.resize.rstnew file mode 100644index 00000000..bc50a104--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.resize.rst@@ -0,0 +1,6 @@+moviepy.video.fx.resize+=======================++.. currentmodule:: moviepy.video.fx++.. autofunction:: resize\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.rotation.rst b/docs/ref/videofx/moviepy.video.fx.rotation.rstnew file mode 100644index 00000000..99efe504--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.rotation.rst@@ -0,0 +1,6 @@+moviepy.video.fx.rotation+=========================++.. currentmodule:: moviepy.video.fx++.. autofunction:: rotation\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.scroll.rst b/docs/ref/videofx/moviepy.video.fx.scroll.rstnew file mode 100644index 00000000..736325d5--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.scroll.rst@@ -0,0 +1,6 @@+moviepy.video.fx.scroll+=======================++.. currentmodule:: moviepy.video.fx++.. autofunction:: scroll\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.speedx.rst b/docs/ref/videofx/moviepy.video.fx.speedx.rstnew file mode 100644index 00000000..2546cebf--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.speedx.rst@@ -0,0 +1,6 @@+moviepy.video.fx.speedx+=======================++.. currentmodule:: moviepy.video.fx++.. autofunction:: speedx\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.time_mirror.rst b/docs/ref/videofx/moviepy.video.fx.time_mirror.rstnew file mode 100644index 00000000..6a1a5c8c--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.time_mirror.rst@@ -0,0 +1,6 @@+moviepy.video.fx.time_mirror+============================++.. currentmodule:: moviepy.video.fx++.. autofunction:: time_mirror\ No newline at end of filediff --git a/docs/ref/videofx/moviepy.video.fx.time_symetrize.rst b/docs/ref/videofx/moviepy.video.fx.time_symetrize.rstnew file mode 100644index 00000000..41c97be0--- /dev/null+++ b/docs/ref/videofx/moviepy.video.fx.time_symetrize.rst@@ -0,0 +1,6 @@+moviepy.video.fx.time_symetrize+===============================++.. currentmodule:: moviepy.video.fx++.. autofunction:: time_symetrize\ No newline at end of filediff --git a/docs/ref/videotools.rst b/docs/ref/videotools.rstindex 9338a776..ad5bdf5e 100644--- a/docs/ref/videotools.rst+++ b/docs/ref/videotools.rst@@ -6,6 +6,8 @@ video.toolsThis module regroups advanced, useful (and less useful) functions for editing videos.++Drawing--------.. automodule:: moviepy.video.tools.drawingdiff --git a/examples/logo.py b/examples/logo.pynew file mode 100644index 00000000..2886f601--- /dev/null+++ b/examples/logo.py@@ -0,0 +1,28 @@+from moviepy.editor import *++import numpy as np++w,h = moviesize = (720,380)++duration = 1++def f(t,size, a = np.pi/3, thickness = 20):+ w,h = size+ v = thickness* np.array([np.cos(a),np.sin(a)])[::-1]+ center = [int(t*w/duration),h/2]+ return biGradientScreen(size,center,v,0.6,0.0)++logo = ImageClip("../../videos/logo_descr.png").\+ resize(width=w/2).\+ set_mask(mask)++screen = logo.on_color(moviesize, color = (0,0,0), pos='center')++shade = ColorClip(moviesize,col=(0,0,0))+mask_frame = lambda t : f(t,moviesize,duration)+shade.mask = VideoClip(ismask=True, get_frame = mask_frame)++cc = CompositeVideoClip([im.set_pos(2*["center"]),shade],+ size = moviesize)++cc.subclip(0,duration).to_videofile("moviepy_logo.avi",fps=24)diff --git a/moviepy/Clip.py b/moviepy/Clip.pyindex bb3e76fc..5a4ab208 100644--- a/moviepy/Clip.py+++ b/moviepy/Clip.py@@ -82,8 +82,8 @@ class Clip:audio or the mask of the clip, if any.keep_duration- Set to True if the transformation does not change the clip's- ``duration``.+ Set to True if the transformation does not change the+ ``duration`` of the clip.Examples--------@@ -215,8 +215,9 @@ class Clip:@time_can_be_tupledef set_end(self, t):"""- Returns a copy of the clip, with the ``end`` attribute set to ``t``.- Also sets the duration of the returned clip's mask and audio, if any.+ Returns a copy of the clip, with the ``end`` attribute set to+ ``t``. Also sets the duration of the mask and audio, if any,+ of the returned clip."""newclip = self.copy()newclip.end = t@@ -237,8 +238,8 @@ class Clip:"""Returns a copy of the clip, with the ``duration`` attributeset to ``t``.- Also sets the duration of the returned clip's mask and audio,- if any.+ Also sets the duration of the mask and audio, if any, of the+ returned clip."""newclip = copy(self)newclip.duration = t@@ -294,8 +295,9 @@ class Clip:If ``tb`` is provided or if the clip has a duration attribute,the duration of the returned clip is set automatically.- The resulting subclip's ``mask`` and ``audio`` will be subclips- of the original clip's ``mask`` and ``audio``, if they exist.+ The ``mask`` and ``audio`` of the resulting subclip will be+ subclips of ``mask`` and ``audio`` the original clip, if+ they exist."""newclip = self.fl_time(lambda t: t + ta, apply_to=[])@@ -322,7 +324,7 @@ class Clip:Returns a clip playing the content of the current clip butskips the extract between ``ta`` and ``tb`` (in seconds).If the original clip has a ``duration`` attribute set,- the returned clip's duration is automatically computed as+ the duration of the returned clip is automatically computed as`` duration - (tb - ta)``.The resulting clip's ``audio`` and ``mask`` will also be cutoutdiff --git a/moviepy/audio/AudioClip.py b/moviepy/audio/AudioClip.pyindex c4ce8b63..70ad95df 100644--- a/moviepy/audio/AudioClip.py+++ b/moviepy/audio/AudioClip.py@@ -14,19 +14,18 @@ if sys.version_info < (3,):class AudioClip(Clip):-- """+ """Base class for audio clips.++ See ``SoundClip`` and ``CompositeSoundClip`` for usable classes.- Base class for audio clips. See ``SoundClip`` and ``CompositeSoundClip``- for usable classes.- An audio clip is a special clip with a ``get_frame`` attribute of- the form `` t -> [ f_t ]`` for mono sound and ``t -> [ f1_t, f2_t ]``- for stereo sound (the arrays are Numpy arrays).+ An AudioClip is a Clip with a ``get_frame`` attribute of+ the form `` t -> [ f_t ]`` for mono sound and+ ``t-> [ f1_t, f2_t ]`` for stereo sound (the arrays are Numpy arrays).The `f_t` are floats between -1 and 1. These bounds can betrespassed wihtout problems (the program will put thesound back into the bounds at conversion time, without much impact).- Attributes+ Parameters-----------get_frame@@ -34,7 +33,7 @@ class AudioClip(Clip):for a sound, it is just a float. What 'makes' the sound arethe variations of that float in the time.- nchannels:+ nchannelsNumber of channels (one or two for mono or stereo).Examples@@ -67,6 +66,7 @@ class AudioClip(Clip):nbytesNumber of bytes to encode the sound: 1 for 8bit sound,2 for 16bit, 4 for 32bit sound.+"""if tt is None:tt = np.arange(0,self.duration, 1.0/fps)@@ -104,7 +104,7 @@ class AudioArrayClip(AudioClip):An audio clip made from a sound array.Parameters- -------------+ -----------arrayA Numpy array representing the sound, of size Nx1 for mono,@@ -146,7 +146,7 @@ class AudioArrayClip(AudioClip):class CompositeAudioClip(AudioClip):- """+ """ Clip made by composing several AudioClips.An audio clip made by putting together several audio clips.diff --git a/moviepy/version.py b/moviepy/version.pynew file mode 100644index 00000000..5d053a1d--- /dev/null+++ b/moviepy/version.py@@ -0,0 +1 @@+__version__ = '0.2.1.7.06'diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.pyindex 619dd029..6b39269d 100644--- a/moviepy/video/VideoClip.py+++ b/moviepy/video/VideoClip.py@@ -86,7 +86,7 @@ class VideoClip(Clip):self.relative_pos = Falseif get_frame:self.get_frame = get_frame- newclip.size = newclip.get_frame(0).shape[:2][::-1]+ self.size =get_frame(0).shape[:2][::-1]self.ismask = ismask@@ -182,7 +182,7 @@ class VideoClip(Clip):temp_audiofile=None,rewrite_audio = True, remove_temp = True,para = False, verbose = True):- """ Write the clip to a videofile.+ """Write the clip to a videofile.Parameters-----------@@ -195,14 +195,18 @@ class VideoClip(Clip):Number of frames per second in the resulting video file.codec- Codec to use for image encoding. Can be- - 'rawvideo','png' : will produce a raw video, of perfect- quality, but possibly very huge size. 'png' is still- lossless but produces smaller files.- - 'mpeg4' : For nice quality, very well compressed videos.- - 'libx264' : A little better than 'mpeg4', a little heavier.- - Any of the (many) other codec supported by ffmpeg.-+ Codec to use for image encoding. Can be any codec supported+ by ffmpeg.++ ``'rawvideo'``, ``'png'`` will produce a raw video,+ of perfect quality, but possibly very huge size. 'png' is+ is lossless and produces smaller files than 'rawvideo'.++ ``'mpeg4'`` produces nice quality, very well compressed videos.++ ``'libx264'`` (default) is a little better than 'mpeg4',+ a little heavier.+audioEither ``True``, ``False``, or a file name.If ``True`` and the clip has an audio clip attached, thisdiff --git a/moviepy/video/fx/loop.py b/moviepy/video/fx/loop.pyindex 99594299..1aa7ba2d 100644--- a/moviepy/video/fx/loop.py+++ b/moviepy/video/fx/loop.py@@ -10,8 +10,12 @@ def loop(self, n=None):"""Returns a clip that plays the current clip in an infinite loop.Ideal for clips coming from gifs.- :param n: number of times the clip should be played. If `None` the- the clip will loop indefinitely (i.e. with no set duration).++ Parameters+ ------------+ n+ Number of times the clip should be played. If `None` the+ the clip will loop indefinitely (i.e. with no set duration)."""result = self.fl_time(lambda t: t % self.duration)if n:diff --git a/moviepy/video/fx/time_symetrize.py b/moviepy/video/fx/time_symetrize.pyindex e81add43..0cbea186 100644--- a/moviepy/video/fx/time_symetrize.py+++ b/moviepy/video/fx/time_symetrize.py@@ -6,11 +6,11 @@ from .time_mirror import time_mirror@requires_duration@apply_to_maskdef time_symetrize(clip):- """- Returns a clip that plays the current clip once forwards and+ """+ Returns a clip that plays the current clip once forwards andthen once backwards. This is very practival to make video thatloop well, e.g. to create animated GIFs.This effect is automatically applied to the clip's mask and audioif they exist.- """- return concatenate([clip, clip.fx( time_mirror )])+ """+ return concatenate([clip, clip.fx( time_mirror )])diff --git a/moviepy/video/tools/credits.py b/moviepy/video/tools/credits.pyindex 7ca7875c..d64e71ea 100644--- a/moviepy/video/tools/credits.py+++ b/moviepy/video/tools/credits.py@@ -17,7 +17,7 @@ def credits1(creditfile,width,stretch=30,color='white',Parameters------------ creditfile:+ creditfileA text file whose content must be as follows: ::# This is a comment@@ -34,13 +34,13 @@ def credits1(creditfile,width,stretch=30,color='white',..Music SupervisorJEAN DIDIER- width:+ widthTotal width of the credits text in pixels- gap:+ gapGap in pixels between the jobs and the names.- **txt_kw:+ **txt_kwAdditional argument passed to TextClip (font, colors, etc.)@@ -49,9 +49,10 @@ def credits1(creditfile,width,stretch=30,color='white',Returns---------- An ImageClip instance that looks like this and can be scrolled- to make some credits :-+ image+ An ImageClip instance that looks like this and can be scrolled+ to make some credits :+Executive Story Editor MARCEL DURANDAssociate Producers MARTIN MARCELDIDIER MARTINdiff --git a/moviepy/video/tools/drawing.py b/moviepy/video/tools/drawing.pyindex 1f10277a..afb35c30 100644--- a/moviepy/video/tools/drawing.py+++ b/moviepy/video/tools/drawing.py@@ -6,7 +6,8 @@ methods that are difficult to do with the existing Python libraries.import numpy as npdef blit(im1, im2, pos=[0, 0], mask=None, ismask=False):- """+ """ Blit an image over another.+Blits ``im1`` on ``im2`` as position ``pos=(x,y)``, using the``mask`` if provided. If ``im1`` and ``im2`` are mask pictures(2D float arrays) then ``ismask`` must be ``True``.@@ -49,38 +50,66 @@ def blit(im1, im2, pos=[0, 0], mask=None, ismask=False):def color_gradient(size,p1,p2=None,vector=None, r=None, col1=0,col2=1.0,shape='linear', offset = 0):- """- Makes linear, bilinear, or radial gradients.+ """Draw a linear, bilinear, or radial gradient.- The result is a picture of size ``size``, whose color varies gradually: from- color `col1` in position ``p1`` to color ``col2`` in position ``p2``.+ The result is a picture of size ``size``, whose color varies+ gradually from color `col1` in position ``p1`` to color ``col2``+ in position ``p2``.If it is a RGB picture the result must be transformed into- a 'uint8' array to be displayed normally:+ a 'uint8' array to be displayed normally:+- >>> grad = colorGradient(blabla).astype('unit8')-+ Parameters+ ------------- :param size: size of the final picture/array+ size+ Size (width, height) in pixels of the final picture/array.- :param p1, p2: coordinates (x,y) of the border point for- ``col1`` and ``col2``+ p1, p2+ Coordinates (x,y) in pixels of the limit point for ``col1``+ and ``col2``. The color 'before' ``p1`` is ``col1`` and it+ gradually changes in the direction of ``p2`` until it is ``col2``+ when it reaches ``p2``.- :param vector: can be provided instead of ``p2``. ``p2`` is then- defined as (p1 + vector).+ vector+ A vector [x,y] in pixels that can be provided instead of ``p2``.+ ``p2`` is then defined as (p1 + vector).- :param col1, col2: can be floats to create gradient masks, or- [R,G,B] arrays to create gradient images.+ col1, col2+ Either floats between 0 and 1 (for gradients used in masks)+ or [R,G,B] arrays (for colored gradients).- :param shape: 'linear', 'bilinear', or 'circular'. In a linear gradient- the color varies in one direction, from point ``p1`` to point ``p2``.-+ shape+ 'linear', 'bilinear', or 'circular'.+ In a linear gradient the color varies in one direction,+ from point ``p1`` to point ``p2``.+ In a bilinear gradient it also varies symetrically form ``p1``+ in the other direction.+ In a circular gradient it goes from ``col1`` to ``col2`` in all+ directions.++ offset+ Real number between 0 and 1 indicating the fraction of the vector+ at which the gradient actually starts. For instance if ``offset``+ is 0.9 in a gradient going from p1 to p2, then the gradient will+ only occur near p2 (before that everything is of color ``col1``)+ If the offset is 0.9 in a radial gradient, the gradient will+ occur in the region located between 90% and 100% of the radius,+ this creates a blurry disc of radius d(p1,p2).++ Returns+ --------- :param offset: percentage of the vector at which the gradient actually- starts. for instance if offset is 0.9 in a gradient going from- p1 to p2, then the gradient will only occur near p2. If the offset- is 0.9 in a radial gradient, the gradient will occur in the region- located between 90% and 100% of the radius.+ image+ An Numpy array of dimensions (W,H,ncolors) of type float+ representing the image of the gradient.+++ Examples+ ---------++ >>> grad = colorGradient(blabla).astype('unit8')"""@@ -145,12 +174,41 @@ def color_gradient(size,p1,p2=None,vector=None, r=None, col1=0,col2=1.0,def color_split(size,x=None,y=None,p1=None,p2=None,vector=None,col1=0,col2=1.0, grad_width=0):- """- Makes an array of size ``size`` divided in two regions by a- straight line, the two regions having different colors.- provide either x, or y, or (c1,c2), or (c1,vector). See below.+ """Make an image splitted in 2 colored regions.++ Returns an array of size ``size`` divided in two regions called 1 and+ 2 in wht follows, and which will have colors col& and col2+ respectively.++ Parameters+ -----------++ x: (int)+ If provided, the image is splitted horizontally in x, the left+ region being region 1.++ y: (int)+ If provided, the image is splitted vertically in y, the top region+ being region 1.++ p1,p2:+ Positions (x1,y1),(x2,y2) in pixels, where the numbers can be+ floats. Region 1 is defined as the whole region on the left when+ going from ``p1`` to ``p2``.++ p1, vector:+ ``p1`` is (x1,y1) and vector (v1,v2), where the numbers can be+ floats. Region 1 is then the region on the left when starting+ in position ``p1`` and going in the direction given by ``vector``.++ gradient_width+ If not zero, the split is not sharp, but gradual over a region of+ width ``gradient_width`` (in pixels). This is preferable in many+ situations (for instance for antialiasing).- Use:++ Examples+ --------->>> size = [200,200]>>> # an image with all pixels with x<50 =0, the others =1@@ -159,25 +217,6 @@ def color_split(size,x=None,y=None,p1=None,p2=None,vector=None,>>> colorSplit(size, x=50, col1=[255,0,0], col2=[0,255,0])>>> # An image splitted along an arbitrary line (see below)>>> colorSplit(size, p1=[20,50], p2=[25,70] col1=0, col2=1)--- :param x (int): If provided, the image is splitted horizontally in x,- the left region being region 1.-- :param y (int): If provided, the image is splitted vertically in y,- the top region being region 1.-- :param p1,p2: Positions (x1,y1),(x2,y2), where the numbers can be floats,- of two points. Region 1 is defined as the region on the left when- going from p1 to p2.-- :param p1, vector: p1 is (x1,y1) and vector (v1,v2), where the numbers- can be floats. Region 1 is then the region on the left when starting- in position p1 and going in the direction given by ``vector``.-- :param gradient_width: if not null, the split is not sharp, but gradual- over a region of width ``gradient_width`` (in pixels). This is- preferable in many situations (for instance for antialiasing)."""@@ -209,7 +248,8 @@ def color_split(size,x=None,y=None,p1=None,p2=None,vector=None,raisedef circle(screensize, center, radius, col1=1.0, col2=0, blur=1):- """+ """ Draw an image with a circle.+Draws a circle of color ``col1``, on a background of color ``col2``,on a screen of size ``screensize`` at the position ``center=(x,y)``,with a radius ``radius`` but slightly blurred on the border by ``blur``