Skip to content
Related Articles

Related Articles

MoviePy – Creating Image Sequence Clip
  • Last Updated : 18 Aug, 2020

In this article we will see how we can create a image sequence clip in MoviePy. MoviePy is a Python module for video editing, which can be used for basic operations on videos and GIF’s. Video is formed by the frames, combination of frames creates a video each frame is an individual image. Image sequence clip is the clip which is formed by combining images one by one to form a sequence i.e video.

In order to do this we will use ImageSequenceClip method

Syntax : ImageSequenceClip([‘image_file1.jpeg’, …], fps=24)

Argument : It takes image file names and fps as argument

Return : It returns ImageSequenceClip object



Below is the implementation




# importing editor from movie py
from moviepy.editor import *
  
# creating a Image sequence clip with fps = 1
clip = ImageSequenceClip(['frame1.png', 'frame2.png', 'frame1.png', 'frame2.png'], fps = 1)
  
# showing  clip 
clip.ipython_display(width = 360

Output :

Moviepy - Building video __temp__.mp4.
Moviepy - Writing video __temp__.mp4

                                                                                                                       
Moviepy - Done !
Moviepy - video ready __temp__.mp4

Another example




# importing editor from movie py
from moviepy.editor import *
  
# creating a Image sequence clip with fps = 3
clip = ImageSequenceClip(['frame1.png', 'frame1.png', 'frame2.png',
                          'frame1.png', 'frame1.png', 'frame2.png',
                          'frame1.png', 'frame1.png', 'frame2.png'], fps = 3)
  
# showing  clip 
clip.ipython_display(width = 360

Output :

Moviepy - Building video __temp__.mp4.
Moviepy - Writing video __temp__.mp4

                                                                                                                       
Moviepy - Done !
Moviepy - video ready __temp__.mp4

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :