Skip to main content

Module for script-based video editing

Project description

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 .

A typical MoviePy script looks like that:

from moviepy import *

# Load myHolidays.mp4 and select the subclip 00:00:50 - 00:00:60
clip =VideoFileClip("myHolidays.mp4").subclip(50,60)

# Generate a text clip (many options available ! )
txt_clip = TextClip("My Holidays 2013",fontsize=70,color='white')
txt_clip = txt_clip.set_pos('center').set_duration(10)

# Overlay the text clip above the first clip
final_clip = CompositeVideoClip([clip, txt_clip])

# write the result to a file in any format
final_clip.to_videofile("myHolidays_edited.avi",fps=25, codec='mpeg4')

Download and Installation

Dependencies

MoviePy cannot run without these dependencies:

  • The software ffmpeg is needed for writing, reading, converting the sound and the video. Normally any version of FFMPEG should work but it is recommended to use a recent version for better results.

  • Numpy is needed for image and sound manipulation

  • The Decorator module is used in the MoviePy code for better code readability

Numpy and Decorator will be automatically installed during MoviePy’s installation if not present on your computer. As for ffmpeg, you can either install it or save the binary files in any folder and specify the path to these folders before installing MoviePy (see manual_install).

Installation with PIP

Just type ::

sudo pip install moviepy

Manual installation

If you want the cutting edge version you can download MoviePy on its Github repository.

Just unzip everything in one folder, open a terminal and type

sudo python setup.py install

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

FFMPEG_BINARY = path/to/your/ffmpeg

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

  • Scipy is needed for many advanced functionalities (tracking, segmenting, etc.)

  • Scikit Image may be needed for some advanced image manipulation.

  • The Python Imaging Library is not used yet (I don’t like the copyright) but it is coming.

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

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

import cv2
print cv2.__version__

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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moviepy-0.2.1.tar.gz (7.8 kB view details)

Uploaded Source

File details

Details for the file moviepy-0.2.1.tar.gz.

File metadata

  • Download URL: moviepy-0.2.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for moviepy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7e6b3d6a02b145e1a9bcfcf1d84d9cf437fe3f37febdf01505637278b7d69be2
MD5 af8abab0610396b544dd8f8f45541739
BLAKE2b-256 04a93d9f10f65f3799c72cd17a34ff26a3c8f9fa07b7f1fe23844be46ca7899e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page