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.)
2I copied that command line from an answer to another question.
-loop 0
repeats forever, so that would be the more typical use. – Peter Cordes – 2015-01-15T10:32:01.083ffmpeg supports apng – Ken Sharp – 2018-02-12T14:54:29.337
1@KenSharp: Yup, ffmpeg now supports encoding apng, too. But AFAIK, most web browsers still don't decode it, so it's still of limited use as an alternative to actual video formats like WEBM or MP4+H264+AAC, or VP9+Opus. – Peter Cordes – 2018-02-12T16:00:23.747
The initial statement is is no longer true. APNG (https://caniuse.com/#feat=apng) has wider support than webp (https://caniuse.com/#feat=webp), and in addition, falls back to displaying the first frame when not supported. However, the situation still isn't perfect.
– Albin – 2018-05-07T00:36:45.887