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

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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

chevron_right


Output :

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

                                                                                                                       
Moviepy - Done !
Moviepy - video ready __temp__.mp4

Another example

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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

chevron_right


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.




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.