News for hackers. Stuff that matters.
Re:Chromium: Add support for Animated PNG by habitue on Tuesday March 14, 2017 @07:19PM (#13872452)
Benefits of apng vs. video?
Re:Chromium: Add support for Animated PNG by pornel on Tuesday March 14, 2017 @07:52PM (#13872653)
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.

Re:Chromium: Add support for Animated PNG by dasfasf on Tuesday March 14, 2017 @09:46PM (#13873155)
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?
Re:Chromium: Add support for Animated PNG by robterrell on Wednesday March 15, 2017 @12:11AM (#13873752)
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.
Re:Chromium: Add support for Animated PNG by aorth on Wednesday March 15, 2017 @03:23AM (#13874397)
What is a sticker pack and why do you need to buy them?
Re:Chromium: Add support for Animated PNG by maxst on Wednesday March 15, 2017 @03:53AM (#13874508)
Re:Chromium: Add support for Animated PNG by japano1se on Wednesday March 15, 2017 @03:48AM (#13874481)
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.
Re:Chromium: Add support for Animated PNG by skybrian on Tuesday March 14, 2017 @08:24PM (#13872839)
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.

Re:Chromium: Add support for Animated PNG by Grue3 on Wednesday March 15, 2017 @07:13AM (#13875272)
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.
Re:Chromium: Add support for Animated PNG by Ajedi32 on Wednesday March 15, 2017 @10:37AM (#13876367)
> 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"?

Re:Chromium: Add support for Animated PNG by Grue3 on Wednesday March 15, 2017 @11:41AM (#13876843)
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.
Re:Chromium: Add support for Animated PNG by TwoBit on Wednesday March 15, 2017 @01:10AM (#13873962)
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?
Re:Chromium: Add support for Animated PNG by vladdanilov on Wednesday March 15, 2017 @03:45AM (#13874469)
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.

Re:Chromium: Add support for Animated PNG by Dylan16807 on Wednesday March 15, 2017 @06:30AM (#13875115)
> 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.

Re:Chromium: Add support for Animated PNG by versteegen on Wednesday March 15, 2017 @06:55PM (#13880678)
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.
Re:Chromium: Add support for Animated PNG by Dylan16807 on Thursday March 16, 2017 @02:51AM (#13883072)
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.
Re:Chromium: Add support for Animated PNG by andrewshadura on Thursday March 16, 2017 @07:52AM (#13884249)
There was a true-colour GIF using more than 256 colours using this technique.
Re:Chromium: Add support for Animated PNG by Dylan16807 on Thursday March 16, 2017 @05:20PM (#13889301)
Sure. It works eventually, but it causes distortion as the frames layer over each other with very visible delays.
Re:Chromium: Add support for Animated PNG by maxst on Wednesday March 15, 2017 @03:36AM (#13874441)
> 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...

Re:Chromium: Add support for Animated PNG by j3097736 on Tuesday March 14, 2017 @09:07PM (#13873036)
Animations can be easily edited with an image editor and most people probably don't want to spend time playing around with ffmpeg flags.
Re:Chromium: Add support for Animated PNG by minitech on Wednesday March 15, 2017 @05:34AM (#13874903)
Lossless video formats (lossless HEVC, lossless WebP) could also be edited with an image editor.
Re:Chromium: Add support for Animated PNG by epigramx on Wednesday March 15, 2017 @03:07AM (#13874344)
> 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.

Re:Chromium: Add support for Animated PNG by mdeeks on Tuesday March 14, 2017 @08:22PM (#13872829)
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

Re:Chromium: Add support for Animated PNG by minitech on Wednesday March 15, 2017 @05:37AM (#13874920)
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>
Re:Chromium: Add support for Animated PNG by pvg on Tuesday March 14, 2017 @08:31PM (#13872873)
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.
Re:Chromium: Add support for Animated PNG by mdeeks on Tuesday March 14, 2017 @10:27PM (#13873311)
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.

Re:Chromium: Add support for Animated PNG by pvg on Wednesday March 15, 2017 @12:11AM (#13873747)
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.
Re:Chromium: Add support for Animated PNG by ecnahc515 on Tuesday March 14, 2017 @10:41PM (#13873368)
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.

Re:Chromium: Add support for Animated PNG by pvg on Wednesday March 15, 2017 @12:38AM (#13873852)
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.
Re:Chromium: Add support for Animated PNG by j3097736 on Tuesday March 14, 2017 @08:59PM (#13872998)
Try replacing those with videos and stand back as the CPU fan spools up at full power.
Re:Chromium: Add support for Animated PNG by pvg on Tuesday March 14, 2017 @09:06PM (#13873032)
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.
Re:Chromium: Add support for Animated PNG by Dylan16807 on Wednesday March 15, 2017 @06:12AM (#13875060)
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.
Re:Chromium: Add support for Animated PNG by pvg on Wednesday March 15, 2017 @11:19AM (#13876693)
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.
Re:Chromium: Add support for Animated PNG by j3097736 on Tuesday March 14, 2017 @09:18PM (#13873062)
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.
Re:Chromium: Add support for Animated PNG by pvg on Tuesday March 14, 2017 @10:37PM (#13873348)
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'.
Re:Chromium: Add support for Animated PNG by untog on Wednesday March 15, 2017 @12:38AM (#13873854)
An autoplaying, looping, silent video with no controls is possible in a web browser with a <video> tag and a few attributes, though.
Re:Chromium: Add support for Animated PNG by magila on Tuesday March 14, 2017 @11:31PM (#13873612)
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.
Re:Chromium: Add support for Animated PNG by jjuuolkkju on Tuesday March 14, 2017 @08:31PM (#13872878)
lossless compression and transparency.
Re:Chromium: Add support for Animated PNG by discreditable on Wednesday March 15, 2017 @08:36AM (#13875639)
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.