The Wayback Machine - https://web.archive.org/web/20210120232713/https://www.geeksforgeeks.org/moviepy-creating-image-sequence-clip/
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

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
Recommended Articles
Page :