Open In App

MoviePy – Creating Image Sequence Clip

Improve
Improve
Like Article
Like
Save
Share
Report

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


Last Updated : 18 Aug, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads