Things that help if you know what they are:

Tutorial Difficulty: Intermediate
Time: 10 - 20 minutes

You can also read this on LBRY/Odysee here

Side note: If you use krita to make animations and you do not have an option to render your animaiton as an APNG, update to the latest version and if there is no update for your system, wait until it is released as this feature will be built in.

Ok. so you just made a sweet animation in your favorite editor or you might simply just have to bunch of individual frames that you want to make an animation out of. Well. This article will cover how to make an APNG with a single command. Yes. This will involve the command line. Deal with it.
If you want some images to practice with you can download this zip.

Step 1

Now, open your terminal or your powershell or your CMD or whatever shell you have and type the word ffmpeg and the return or enter key, if you see something like this: ffmpeg version n4.4.1 Copyright (c) 2000-2021 the FFmpeg developers then you are good to go to step 2. If you don’t, go to step -1 after this paragraph this will involve more than one command because you do not have ffmpeg installed. WAIT BEFORE YOU GO LOOKING ELSEWHERE FOR “EASIER” GUI ALTERNATIVES, I urge you to keep going with this.

Step -1

Ok so we need to get ffmpeg installed else you can skip this section.
Depending on your operating system, there are different ways to install ffmpeg. If you are on other Operating systems other than GNU/Linux, you may want to figure out how to install ffmpeg through other places. But if you are on GNU/Linux and for some ungodly reason you do not have ffmpeg installed, here is how you can install it.

sudo runs commands with the utmost privilage on your computer.

For arch and other arch based distributions:
sudo pacman -S ffmpeg

For debian, ubuntu based distros:
sudo apt get install ffmpeg

For fedora, centos:
Add the repository
sudo dnf -y install$(rpm -E %fedora).noarch.rpm
sudo dnf -y install$(rpm -E %fedora).noarch.rpm

update to the latest packages
sudo dnf update
And finally install it.
sudo dnf install -y ffmpeg
After you have installed ffmpeg, repeat step 1 to check.

Step 2

Assuming that you have your individual frames, read on.

In your terminal window, change to the directory where you have the individual images.
Example: cd /home/az/example

and now just use this command:
ffmpeg -r 24 -i frame%0004d.png -plays 0 -f apng final.png

-r is the frame rate

-i is the input file name structure using regular expressions.

The %0004d part tells ffmpeg to take all files with 4 digits and padded with zeros. So your files should be like this frame0001.png frame0002.png frame0003.png and so on. If they are like 1.png 2.png 3.png then you can change the %0004d to %d

-plays controls the number of loops that the animation will do. 0 is infinite and positive integers is how many times to loop.

-f is the format

and lastly the name of the output file.
If you individual images are some other format than “PNG” feel free to change that for the -i portion for example frame%0004d.jpg and you should be done. Your final.png should be an animated one.
Some image editors/viewers might not view it as aminated. So I suggest that you open the image with a web-browser.


Congrats if you were able to make your very own APNG animation. Great! Now, you gotta share it. Ohh wait… Look at the size of the animation. IT’S FUCKING HUGE.

Well. no worries. Introducing AVIF

AVIF is a new image format that is super new and amazing. It compersses better than JPG and GIF and supports animations. So here is how you can turn your individual frames into an AVIF file. You will need to lave libavif installed. on arch and arch-based distros install libavif with this command sudo pacman -S libavif

Once this is done, you can use the avifenc command to convert images like this.
evifenc input-image.png output-image.avif

So cd to your folder where your images are located then use this command to make an avif animation. ffmpeg -r 24 -i frame%0004d.png -pix_fmt yuv420p -f yuv4mpegpipe - | avifenc --stdin final.avif

Why not just use AVIF in the first place?

Because not all browsers support it.


If you like pixel art, retro and niche music, check out our matrix chat

Check out my pixelart shop where you can buy, modify and freely share or use in your own material.

For livestreams and random behind the scenes videos of friends and I doing random stuff like drawing pixel art, working on projects and talking about free software and what not, check out DeadPixels

Also check out @BlenderDumbass’s matrix chat where we chat about anything from webdevelopment, programming, hacking, GNU/Linux, and where we discuss our pixel art game project based on the movie “I’m not Even Human”