This takes files in the current directory named like 1.png 2.png 3.png ...
and creates a gif out.gif
.
ffmpeg -i ./%001d.png -vf palettegen=reserve_transparent=1 -f apng pipe:1 \
| ffmpeg -framerate 3 -i ./%001d.png -i - -lavfi paletteuse=alpha_threshold=128 -gifflags -offsetting out.gif
Change the framerate by changing -framerate 3
to your desired value.
Change the directory by changing the ./%001d.png
in both parts of the command.
Change the output location by changing out.gif
at the end of the command.
This doubles the size of the gif while keeping transparency and not using algorithms (Good for pixel art).
Change how much it upscales by changing scale=iw*2:ih*2
, the numbers is the multiplier.
ffmpeg -i out.gif -filter_complex \
"[0:v] scale=iw*4:ih*4:flags=neighbor,split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse" out2.gif
To change the input, change out.gif
in the first part of the command.
To change the output, change out2.gif
at the end of the command.
ffmpeg -i out.gif -filter_complex \
"[0:v] scale=iw*4:ih*4:flags=neighbor,pad=width=200:height=200:x=24:y=16:color=black, split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse" out2.gif
Change the params after pad=
to customise. Width and height is the end resolution, x and y are the position of the original video. Color is the padding colour.