FFmpeg different sized images to gif while preserving original aspect ratio
<p>I am trying to create a GIF from a bunch of JPEG images with different sizes while preserving the aspect ratios for each one of them. What I am trying to achieve is let's say we have a rectangle with 640x480 and the image should be centered in it and expanded to fill the dimensions as much as possible. The resulting gif should be as small as possible in dimensions and all the blank space should be in solid color.</p>

<pre><code>ffmpeg -f image2 -i img_%d.jpg -vf scale=640x480:force_original_aspect_ratio=decrease output.gif
</code></pre>

<p>force_original_aspect_ratio=<strong>increase</strong> didn't help either.</p>

<p>Actually I tried lot of different options, but the result is pretty much the same. The options are applied on the first image of the sequence only, and all the other images are resized to the dimensions of the first one without preserving their own aspect ratio.</p>

<p>I just want to know is that doable with ffmpeg or should I look into custom image manipulation before the gif assembling?</p>