Convert video to apng/png? [closed]

I tried to do this with ffmpeg but failed (I also failed making animated GIFs). Is there a simple to use free program (command line is okay) to convert videos to animated PNGs?

As long as it doesn't dump the video frame by frame into PNG files and create a monster size PNG then I should like it. (I didnt see an option to make ffmpeg not dump every frame)

alt text

From the wiki http://en.wikipedia.org/wiki/APNG


mng never gained much support, but APNG apparently has some support these days (FF/Chrome/Safari); more than WebP (Chrome/Opera). Be sure to check for browser support for the format to see if it's compatible with your use-case. (Note that APNG falls back to displaying the first frame like a non-animated PNG.)

FFmpeg can decode and encode animated png, as well as animated gif and webp. (No other FFmpeg output formats support a loop flag in the container, as far as I can tell, not even nut, mkv, or ogg.) Older versions of FFmpeg only supported apng as an output format (encode but not decode).


webp is the current animation-supporting image format that's trying to gain traction. With google behind it, there's a good chance. It can do lossy and lossless, and even lossy-image with lossless-transparency. It's based on the intra-frames of the VPx video codec, IIRC.

ffmpeg can create webp animations, but even ffplay can't play them back. vwebp (in the webp package) can.

ffmpeg -framerate 15 -i b93-'%d.png' -loop 128 containerloop.webp. (Or -i foo.mp4 or whatever).


The other option for putting repeating loops of images on the web is an HTML5 video tag with the loop attribute. Great for higher resolution, and live action (rather than computer graphics with a lot of areas all the same color). Don't use it all over the place instead of animated gifs, though. Web browsers aren't optimized for lots of small videos on pages.

You can make highly-compressed and/or low frame rate video to get high quality short loops in only a couple hundred kiB for live action, or only a few kiB for simpler stuff, using modern high-quality encoders like VP9 or x264. (Or maybe in a few years, x265, which is fantastic at very low bitrates for the resolution, i.e. very low bits per pixel.)


This sort of thing has been done before (with gif) using imagemagick. APNG is not an official file format - the PNG group doesn't support this extension. Even if you get this to work, you are likely going to have lingering issues. You should probably consider an animated gif, unless you have some reason you are forced to use png.

Checkout the page on Video Handling. Also take a look at Animation Basics and Optimization.

I appear to be able to convert avi to apng directly on linux, but it fails on windows. A work around on windows would be to convert the movie to a sequence of stills:

convert test.avi frame%04d.png

if you want to use ffmpeg, this will extract frames every 5 seconds:

ffmpeg -i test.avi -y -ss 5 -an -r 1/5 frame%03d.png

then making the animation by using the apng edit firefox plugin.