![]() |
VOOZH | about |
MoviePy is a Python module for video editing, which can be used for basic operations (like cuts, concatenations, title insertions), video compositing (a.k.a. non-linear editing), video processing, or to create advanced effects. It can read and write the most common video formats, including GIF.
Installation
To install the Movie Editor Library, open terminal and write :
pip install moviepy
Note: This module automatically installs FFmpeg. However, you might prompt to install in some cases.
Even after installing MoviePy there will be some features that can't be used unless ImageMagick is installed, features like adding text on the video or on GIFs.
Installation of ImageMagick
ImageMagick is not strictly required, only if user want to write texts. It can also be used as a back-end for GIFs although user can do GIFs with MoviePy without ImageMagick. Below is the link for downloading ImageMagick
https://imagemagick.org/script/download.php
Once it is installed, ImageMagick will be automatically detected by MoviePy, except on Windows. Windows users have to go into the moviepy/config_defaults.py file and provide the path to the ImageMagick binary called magick.
IMAGEMAGICK_BINARY = "C:\\Program Files\\ImageMagick_VERSION\\magick.exe" or for some older versions of ImageMagick it will be IMAGEMAGICK_BINARY = "C:\\Program Files\\ImageMagick_VERSION\\convert.exe"
Example 1
We will load the video, and we will cut a clip from the whole video then the video will be rotated upside down, in this example, there is no need for ImageMagick installation.
Below is the implementation
Output :
Moviepy - Building video __temp__.mp4. Moviepy - Writing video __temp__.mp4 Moviepy - Done ! Moviepy - video ready __temp__.mp4
Example 2:
We will load the video and we will cut a clip from the whole video then we will add text in the video, in this example we have to install ImageMagick otherwise it will not work.
Below is the implementation
Output :
Moviepy - Building video __temp__.mp4. Moviepy - Writing video __temp__.mp4 Moviepy - Done ! Moviepy - video ready __temp__.mp4
Exporting Video files:
You need function write_videofile(arg1, arg2), If you do not, it won't reflect on the hard-disk file as the file was loaded in RAM.
Output:
Merging Video files -
We can merge 2 video files to a single file in order of our requirement
Output:
To know the length of the video:
Output:
9.04
Advantages of MoviePy
Disadvantages of MoviePy :