Organization of MoviePy’s code¶
This reviews the folders and files in moviepy’s code. It’s very easy:
At the root of the project you have everything required for the packaging and installation of moviepy (README, setup.py, LICENCE) etc. Then you the
docs/ folder with the source code of the documentation, a folder for some Example Scripts, and the main folder
moviepy/ for the source code of the library itself.
moviepy/ the classes and modules relative to the video and the audio are clearly separated into two subfolders
moviepy/ you will find all the classes, functions and decorations which are useful to both submodules
Clip.pydefines the base object for
VideoClipand the simple methods that can be used by both, like
config_defaults.pystore the default paths to the external programs FFMPEG and ImageMagick.
decorators.pyprovides very useful decorators that automatize some tasks, like the fact that some effects, when applied to a clip, should also be applied to it’s mask, or to its audio track.
tools.pyprovides misc. functions that are useful everywhere in the library, like a standardized call to subprocess, a time converter, a standardized way to print messages in the console, etc.
editor.pyis a helper module to easily load and initiate many functionalities of moviepy (see How to be efficient with MoviePy for more details)
moviepy.video are organized approximately the same way: at their root they implement base classes (respectively
VideoClip) and they have the following submodules:
iocontains everything required to read files, write files, preview the clip or use a graphical interface of any sort. It contains the objects that speak to FFMEG and ImageMagick, the classes AudioFileClip and VideoFileClip, the functions used to preview a clip with pygame or to embed a video in HTML5 (for instance in the IPython Notebook).
fxcontains a collection of effects and filters (like turning a video black and white, correcting luminosity, zooming or creating a scrolling effect). To add an effect to MoviePy, you simply add a new file
my_effect.pyto this folder, and in the file you define the function
compositingcontains functions and classes to compose videoclips (CompositeVideoClip, concatenate_videoclips, clips_array)
toolscontains advanced tools that are not effects but can help edit clips or generate new clips (tracking, subtitles, etc.)