MoviePy: Simply Edit Video Files with Python
MoviePy is a Python library for video editing, offering features such as cutting, concatenations, video compositing, and custom effects. It supports various audio and video formats and runs on Windows, Mac, and Linux with Python 3.6+.
MoviePy depends on NumPy, Imageio, Decorator, and Proglog, which are automatically installed during MoviePy's installation. FFMPEG is also automatically downloaded/installed during the first use of MoviePy.
You can check the examples and tutorials set in the project's documentation page.
Install
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:
$ (sudo) python setup.py install
How does it work?
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:
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...
Install with PIP
$ (sudo) pip install moviepy
License
- MIT License.