Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Benefits of apng vs. video?


Hard to find any. It's a primitive format ignoring 20 years of video compression research. It tries to be replacement for GIF by repeating its mistakes: it has very basic inter-frame compression, lacks motion vectors, doesn't guarantee keyframes, RGB-only, and frame decoding isn't parallelizable.

In 8-bit mode it supports even fewer colors than GIF (GIF can combine frames to achieve thousands of colors), and in 24-bit mode it's larger than GIF.

For full-motion video it requires 10x-15x more data than VP9 to be decompressed by the CPU, and there's no hardware acceleration.

https://kornel.ski/efficient-gifs

There's false dichotomy between "animations" and "videos", mostly due to historical reasons and that older codecs (and AWebP) used 4:2:0 subsampling which made them blurry. VP9 supports alpha, 4:4:4 mode, and it's cheaper to decode (it's more complex, but using 10x less data offsets that), so it'd be best to forget that GIF and APNG ever existed.


Which makes the timing all the more inscrutable. AV1 is supposed to have its bitstream finalized this month. Why now, when WebM is so widespread and there are new formats on the horizon, resurrect APNG after neglecting it at the only time it was relevant?


APNG is the format Apple is using for sticker packs in iMessage. I'm gonna go out on a limb and guess Google is ramping up to announce a sticker store for Allo... sticker pack devs could port them over without any effort.


What is a sticker pack and why do you need to buy them?



Small pictures to put in chat clients, rather like large emoji. It seems pointless, but I've had friends complain about going from clients that support stickers back to text chats like irc.


I wouldn't say it's a false dichotomy.

Technical limitations result in different cultural and artistic usages. Twitter's arbitrary 140 character limit resulted in a distinct culture. And it seems like not being allowed to embed images at all on Hacker News is part of this site's distinct culture.

And similarly with gifs. The question is whether you can move to a modern format (for better battery life) without also removing the limitations that resulted in a genre that's not just embedding an arbitrary video in a page.


GIF and APNG are not video formats. They are lossless image formats that support sequential animation. They have never been intended to share video clips. You have a very narrow view of what can be done with GIF and APNG.


> They are lossless image formats that support sequential animation

VP9 can also be lossless if desired, and what is a video if not "sequential animation"?


That's like saying that audio is nothing but 0s and 1s. Video has analog origins, and digital video formats are heavily influenced by this. All the video compression techniques make little sense for animation, unless you like JPG artifacts and banding. There's no video format that supports transparency on most browsers. There's no video format that works with tiny dimensions (I tried to upload a 3x3 gif to Imgur and it failed because it couldn't convert it to "gifv"). Video formats have no concept of palette, frame delays and frame disposition. APNG with its partial transparency support offers so many possibilities in web design that it's really a shame Chrome didn't support it for so long.


If video is so much better then why do we see it used so much less than it ought to be? Possibly partly because generating video is too difficult for many?


Agree that APNG is a poor replacement for GIF being mostly used to share video scenes, and VP9, having all those properties, is a perfect one.

The only problem is that VP9 is still lossy with RGB -> YUV -> DCT -> YUV -> RGB, similar to JPEG at quality 100. It kills it for universal use.

Moreover, it's a poor choice for vector animation and there's a high demand for it. But the same applies to APNG and GIF.


> In 8-bit mode it supports even fewer colors than GIF (GIF can combine frames to achieve thousands of colors)

That's... technically possible but it gives you a ridiculous level of time-based artifacting when you need more than 256 colors to appear at the same time.

APNG beats animated GIF for most cases where animated GIF is useful. Just like PNG beats GIF for most cases where non-JPEG images are useful.


Time-based artifacting? I think you might not be aware that it's not necessary to have a time delay between frames (in fact, time delays and animations are actually a Netscape extension to the format!) In fact breaking a frame up into multiple pieces with different bounding boxes is a compression technique used to reduce the amount of zero bytes that need to be encoded/compressed. ImageMagick and gifsicle will do this.


If you set the delay between frames to 0 or 1 hundredths of a second, browsers will assume it's a mistake and bump it up, usually to 10. The fastest you can actually make the delay is 2/100 of a second. There's no way to have multiple frames show up simultaneously.


There was a true-colour GIF using more than 256 colours using this technique.


Sure. It works eventually, but it causes distortion as the frames layer over each other with very visible delays.


> so it'd be best to forget that GIF and APNG ever existed.

There are some good arguments in "Why not simply support WebM in <img>?": https://developers.google.com/speed/webp/faq#why_should_i_us...


Animations can be easily edited with an image editor and most people probably don't want to spend time playing around with ffmpeg flags.


Lossless video formats (lossless HEVC, lossless WebP) could also be edited with an image editor.


> It's a primitive format ignoring 20 years of video compression research.

It's why I find it hard to understand the excitement of many here about it.

This is very likely to take us backwards since most people don't get it.


User experience.

Gifs/apng load and play instantly* and loop. There is no play button to click. No volume button, sliders, etc.

One simple link. Instant load and play.

*assuming good bandwidth


User experience is worse with GIF. It takes more bandwidth and consumes more CPU time than a comparable video in cases where video is applicable (and when the other cases occasionally pop up, lossless WebP is probably still a better choice). HTML5 video can be set to autoplay and loop and doesn’t have controls by default:

  <video autoplay loop src="…"></video>


The user experience is miserable. They take longer to start, impossible to stop, burn bandwidth and CPU. Scroll through something like kotaku sometimes, it's an utter poopfest.


Every single gif on that page loaded instantly for me. Chrome inspector says it took 300ms to load this gif: https://i.kinja-img.com/gawker-media/image/upload/s--6Z2c_2K...

When I paste that in an incognito window it displays and plays instantly.


300ms is a good target for a page load, not for a pointless animation. And that's a 3MB gif. The page also contains a 2.6MB one, two 6+MB ones and one over 7MB. The entire page is over 30MB. Scrolling through it takes the sort of bandwidth typically used for a high quality streaming movie. At 1 to 2 MB/sec you can easily miss something is an animation in the first place because it won't have time to load. Of course, you're not really missing anything other than a low-fps repeated distraction you can't choose to start or stop. This is a good user experience the way a fresh pile of manure is warm shelter.


All true, but those aren't necessarily problems with the concept of a gif, and could be fixed with another format, that isn't necessarily a full on video.

I think the concept of gif's is fairly great, but the actual format itself has tons of issues.


It seems to be covered adequately by formats supported by current browsers. Try pasting a link to a gif in Facebook. Facebook will convert it to an mp4 and put a big 'GIF' button on top of it. This doesn't seem to bother or be noticed by (statistically) anybody.


Try replacing those with videos and stand back as the CPU fan spools up at full power.


With non-flash videos? Hasn't been my experience under OS X, at least. Tiny gifv videos just play. 1080p, 60p video doesn't turn on the fans.


A dozen imgur tabs with a single gifv each have caused me notable background CPU use in Firefox. A dozen tabs with gifs in them don't.


That doesn't really count. A dozen tabs in Firefox might also give you a rash, the solution is to probably stop using Firefox not to convert videos to gifs.


That's not a fair comparison with gif/apng if the thing can pick between webm or mp4 to get hardware acceleration and start/stop off-screen videos.


Why is it not a fair comparison? A page full of gifs in a browser gobbles bandwidth, can't be interrupted, eats lots of cpu. A page full of gifvs doesn't have any of these problems. One of these is a lousy user experience, the other one is not. I don't have to make both of these things a shitty user experience just so the comparison is 'fair'.


An autoplaying, looping, silent video with no controls is possible in a web browser with a <video> tag and a few attributes, though.


It's much like PNG vs JPEG. Like JPEG, the most common video codecs all use compression based on the discrete cosine transform (DCT). This makes them well suited for most video content which has a lot of continuous tones. APNG is better suited for simple animations with lots of flat shading, where video codecs would generate ugly artifacts. A classic example where APNG would be preferred is the ubiquitous throbber animation used by various applications to indicate that they are busy with some task.


lossless compression and transparency.


vp9 supports both of those.

Alpha channel demo: https://simpl.info/videoalpha/

In ffmpeg, the -lossless 1 parameter gives you a lossless encode. I don't use it much because mp4 lossless (-qp 0) has better compression and is faster.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: