MoviePy – Creating Image Sequence Clip
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
from moviepy.editor import *
clip = ImageSequenceClip([ 'frame1.png' , 'frame2.png' , 'frame1.png' , 'frame2.png' ], fps = 1 )
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
from moviepy.editor import *
clip = ImageSequenceClip([ 'frame1.png' , 'frame1.png' , 'frame2.png' ,
'frame1.png' , 'frame1.png' , 'frame2.png' ,
'frame1.png' , 'frame1.png' , 'frame2.png' ], fps = 3 )
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
Share your thoughts in the comments
Please Login to comment...