Convert a series of PNGs to an animated gif or video file

6

2

I have a series of PNG image files that I want to convert into animation.

What is the best way to convert them into a GIF?

Also I have tried various tools to convert them into a video file (like ffmpeg), however they produce a poor quality video. Using the Video Sequence Editor in Blender produces the desired quality however I do not know how to automate this.

(Using ImageMagick's convert takes too long, is there a way to speed it up?)

user92599

Posted 2011-08-02T09:48:59.040

Reputation: 61

Answers

4

If you want to convert an image sequence into an animated .gif, the easiest way is via ImageMagick's convert command:

convert -delay 5 -layers Optimize $FILE_LIST foo.gif

The above command combines all of the files into an optimized animated .gif with a 5 millisecond frame time. You can also do more complicated things with timing via something like:

convert -layers Optimize -delay 5 frame1.png frame2.png -delay 10 frame3.png animation.gif

which gives a 5ms delay for frame1 and frame2, and a 10ms delay for frame3.

fluffy

Posted 2011-08-02T09:48:59.040

Reputation: 595

2

If you're concerned about quality, don't convert to GIF.

To create a video, you can use ffmpeg:

ffmpeg -f image2 -i 'image%d.png' -vcodec copy out.mkv

-f image2 -i 'image%d.png' tells ffmpeg to read the PNG images image1.png, image2.png, etc. in sequence. -vcodec copy losslessly stores the images in a video stream. The resulting video is playable in vlc or totem.

Since the image data is just copied, this will be very fast and of course lossless.

(See "How do I encode single pictures into movies?" in ffmpeg's docs.)

Mechanical snail

Posted 2011-08-02T09:48:59.040

Reputation: 6 625