Create animated gif from a set of jpeg images

Viewed 101286

I need something that can be scripted on windows 7. This image will be used in banners.

6 Answers

I'd just like to add to dwurf's answer, that this will generate a gif with the standard 256-colors palette, which does not look very visually pleasing.

I've found two blog-posts and adapted them to my needs, in order to improve the visual quality by using a custom palette for your animation:

Generate the color palette:

ffmpeg -f image2 -i image%d.jpg -vf scale=900:-1:sws_dither=ed,palettegen palette.png

Convert images into a regular video with the desired framerate, because the third command only worked with a single input video and not a bunch of images

ffmpeg -f image2 -framerate 1.2 -i image%d.jpg video.flv

Now convert the generated video with the generated palette into a more beautiful gif:

ffmpeg -i video.flv -i palette.png -filter_complex "fps=1.2,scale=900:-1:flags=lanczos[x];[x][1:v]paletteuse" video.gif

Based on the answers of Simon P Stevens and dwurf I came up with this simplified solution:

ffmpeg -f image2 -framerate 1 -i image%d.jpg video.gif

This results in a rate of 1 second per image. Adjust the framerate value according to your needs.

Related