Python: Make a video using several .png images

Question:

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:

https://sites.google.com/site/timelapsepy/home

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.

Asked By: user1620716

||

Answers:

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

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
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.