2 posts tagged


 No comments    3   11 d   animation

Gif creation from sequence of images or mp4

When I need to create gifs I ususally use After Effects and plugin GifGun.
But sometimes it doesn’t play nice with colors. They have an “experimental engine” inside as an option but that result in huge size gifs.
Some people use Ezgif. But it has some limitations and you need to upload to web.

So this weekend I tried ImageMagick.
It also installs FFMPEG. So you use it first to convert videos or image sequeces to gif first. And then compress it with ImageMagick. There is no GUI on Windows so you use Command Prompt (it’s like Terminal on Mac).

First you change your current location to the directory where you files are with. Just type cd, drag and drop directory in the “terminal” and hit enter.

I rendered 720x1280px image sequece in houdini with names like this:

So to convert it to 24 fps gif with half-resolution and custom color pattern (for better colors representation) I used this line:

ffmpeg -r 24 -i CAM_top.%04d.tif -filter_complex “[0:v] scale=360:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse” output_360px.gif

And then compressed it with ImageMagick with this:

magick convert output_360px.gif -fuzz 1% -layers Optimize output_360px_fuzz1.gif

fuzz1 – controls the amount of compresion. For example in some other tests fuzz5 gave ok results and smaller files size.
Here is another example of creating gif from mp4 – with rescaling, changing fps and single pattern generation. Split just means that we split this video into 2 and one use for pattern generation and other for convetion to gif after that:

ffmpeg -i video_source.mp4 -filter_complex “[0:v] fps=12,scale=540:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse” output_name.gif

Creating gif from mp4 – with rescaling, changing fps. Pattern generated for every frame – this helps if there are lots of color variations in gif but will increase the size:

ffmpeg -i video_source.mp4 -filter_complex “[0:v] fps=12,scale=w=540:h=-1,split [a][b];[a] palettegen=stats_mode=single [p];[b][p] paletteuse=new=1” output_name.gif

Here is single camera view (6 MB):

And here is 15 seconds version with lots of motion (21 MB):

 7   23 d   animation   houdini   windows