Python: Make a video using several .png images [closed]

Posted on

Question :

Python: Make a video using several .png images [closed]

I’m trying to make a video using a series of .png images. I found this Python script, but I am not entirely sure on how to use it:

I also tried to look into opencv, but it doesn’t seem to install properly for me. Any ideas on a simple program to string several images together to create a time-lapse video? I would like to use Python for this if possible.

Answer #1:

If you really need a scripted python solution, you can look into using PIL

But if you just want to easily convert a sequence of png images to a movie, you can simply use ffmpeg:

ffmpeg -f image2 -r 1/5 -i image%05d.png -vcodec mpeg4 -y movie.mp4

This command takes images with 5 digit padding (image00001.png) and compresses them into an mpeg4 quicktime, at a rate of holding each frame for 5 seconds. You could do a different fps if your images are greater: -r 24 (24 frames per second)

Answered By: jdi

Answer #2:

Instead of ffmpeg, you might want to use avconv

avconv -f image2 -i figMatplotlib%d.png -r 76 -s 800x600 foo.avi
Answered By: Qin Chen

Leave a Reply

Your email address will not be published. Required fields are marked *