MoviePy is a Python Libraries for video editing, which can be use 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, includes GIF(graphics interchange format) is knows as Moviepy Python Libraries. MoviePy is an open source software. It is written by Zulko and release under the MIT licence. It work on Windows, Mac, and Linux with Python 2 and Python 3.

MoviePy
MoviePy

Installation of MoviePy Module in Python

pip install moviepy

Advantages of MoviePy

  • Basic operations can be done in online and it is code is easy to learn.
  • Users have total control over the frames of the video and audio.
  • The code uses very common software such as FFMPEG.

Disadvantages of MoviePy

  • MoviePy cannot yet stream videos.
  • It is not really design for video processing involving many successive frames of a movie.
  • Memory problems can arise.

Example of MoviePy

from moviepy.editor import*

clip =VideoFileClip("C:\Users\Dell\Desktop\aku cimage\HTML\mac\bal ganesh.mp4")

clip =clip.subclip(0, 20)

clip =clip.rotate(120)

clip =clip.volumex(0.7)

clip.ipython_display(width =250)

Output of MoviePy

Moviepy - Building video __temp__.mp4.
Moviepy - Writing video __temp__.mp4                                                                                                                    
Moviepy - Done !
Moviepy - video ready __temp__.mp4

Loading Video Using Python Video Editing Library

A Video has been load we can perform various operations on the video. We will cut a clip from the Whole video then the video will be rotate. As moviePy is measure time in sec.

The code are as follow

ExtensionCode
mp4libx264
ogvlibtheora
webmlibvpx
ogglibvorbis
mp3pcm_s16le
m4alibfdk_aac
wavlibvorbis

 Merging Video files 

merge 2 video files to a single file in order of our requirement.

Example of Merging Video files

import moviepy.editor

clip_1=moviepy.editor.VideoFileClip("C:\Users\Dell\Desktop\aku cimage\HTML\mac\bal ganesh.mp4")

clip_2=moviepy.editor.VideoFileClip("C:\Users\Dell\Desktop\aku cimage\HTML\HTML par\kota 2.mp4")

Mearged_video=moviepy.editor.concatenate_videoclips([clip_1,clip_2])

Mearged_video.write_videofile("Output.mp4",codec='libx264')

print("Done")

Output Of Merging Video files

Moviepy - Building video __Output__.mp4.                                                                                                                    
Moviepy - Done !
Moviepy - Building video __Output__.mp4.
Moviepy - Done !
Moviepy - video ready __Output__.mp4

If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.

To know more about Moviepy Library Function please Wikipedia Click here.

Stay Connected Stay Safe, Thank you.


Basic Engineer

Hey Readers! We have more than fifteen years of experience in Software Development, IoT, Telecom, Banking, Finance and Embedded domain. Currently we are actively working on Data Science, ML and AI with multiple market leaders worldwide. Happy Reading. Cheers!

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *