News for hackers. Stuff that matters.
Re:High quality GIF with FFmpeg by 1ris on Monday March 16, 2015 @04:11PM (#9214035)
>As you probably know, GIF is limited to a palette of 256 colors.

No, it's not. OK, the current, wrong, implementations do limit it to 256 colors, but that's not a limitation of gif. Mulitple frames without a delay allow multiple pallets and multiple times 265 colors.

But this limitation is just another reason not to use it.

Can I use Webm?

http://caniuse.com/#feat=webm

Yes, you can, and you should. Or h.264:

http://caniuse.com/#feat=mpeg4

Re:High quality GIF with FFmpeg by ux on Monday March 16, 2015 @04:17PM (#9214075)
Can you show an example of an animation with more than 256 colors?

As you said, the hack to get more than 256 colors is to redefine a sub rectangle with a new palette. But that's also the mechanism used to make animations. Are you able to get fluid playback with that?

Note: I'm not talking about new frame being just a new sub rectangle, more about N sub rectangles for the same frame, then a delay event, then M sub rectangles for the new frame, etc

Re:High quality GIF with FFmpeg by 1ris on Monday March 16, 2015 @04:22PM (#9214120)
None that works with current browsers implantations, because they erroneous ignore no delay between frames and wait anyway. But that's a bug in the gif decoder, not a limitation of gif. OK, this is hairsplitting, but it illustrates how borken the state of gif is.
Re:High quality GIF with FFmpeg by ChrisLomont on Monday March 16, 2015 @09:12PM (#9215681)
Actually, regarding the delay, the spec reads

    "vii) Delay Time - If not 0, this field specifies the number of hundredths (1/100) of a second to wait before continuing with the processing of the Data Stream. "
A zero delay is most certainly not covered by the spec, and anyone using one is creating GIFs that do not meet the spec.

[0] http://www.w3.org/Graphics/GIF/spec-gif89a.txt

Re:High quality GIF with FFmpeg by bbllee on Tuesday March 17, 2015 @12:47AM (#9216333)
You can achieve no delay without using a zero delay. Graphic Control Extension blocks may be omitted between images and so multiple images can come in a row without anything defining a delay between them.

See the last instance of the phrase "graphic control" in the document to see that multiple images can come with no intervening GCE blocks and see the paragraph containing the 5th instance of that phrase to observe that a GCE block only affects the first image following the GCE.

Re:High quality GIF with FFmpeg by eridius on Monday March 16, 2015 @05:05PM (#9214384)
Maybe someone who cares about this should submit patches? All of the major browser engines are open-source.
Re:High quality GIF with FFmpeg by chc on Monday March 16, 2015 @05:10PM (#9214407)
This would probably cause regressions with other GIFs that neglect to specify a delay but are supposed to have one. It's hard to imagine this universal behavior is accidental. It's probably like everything else on the Web — a hack to keep things that shouldn't work from actually not working.
Re:High quality GIF with FFmpeg by wzdd on Monday March 16, 2015 @05:47PM (#9214637)
I'm fairly sure that the reason for this universal behaviour is that there are plenty of broken, looping gifs out there with inter-frame delays of 0. I used a version of Konqueror which would spin at 100% of a core when it encountered one of these.

A better hack (but it's still a hack) might be to wait one frame (or longer) before returning to the beginning of a looping gif. Given that this would be significantly harder than the current approach (which is apparently either delay = max(delay, 16ms) or if(delay < 16) delay = 100) and the only reason for it would be to support this pretty-niche multi-palette composited-frame thing, it seems like it would be hard to argue for.

Re:High quality GIF with FFmpeg by eridius on Monday March 16, 2015 @07:52PM (#9215344)
Are there GIFs that specify a delay on some frames but not others, and expect all frames to have a delay? Because it should be easy to detect animated GIFs that specify no delay for any frame, and treat them all as having a delay.
Re:High quality GIF with FFmpeg by neolefty on Monday March 16, 2015 @08:08PM (#9215432)
A workaround for the workaround: for a high-color gif, add a blank "animation" frame at the end that has a delay, after all the no-delay buildup elements.

However, that's unlikely to be necessary because if you are just doing a high-color image with no animation, you may as well use JPEG or PNG.

Re:High quality GIF with FFmpeg by chc on Monday March 16, 2015 @07:55PM (#9215355)
As I understand it, that would still block this "large-palette GIF" trick, because those would also consist entirely of frames with no delay.
Re:High quality GIF with FFmpeg by eridius on Monday March 16, 2015 @08:26PM (#9215518)
I assumed that the "large-palette GIF" would have animation. Otherwise, why are you bothering with tricky GIFs at all, why not just use a PNG (or JPEG, depending on the image type)?
Re:High quality GIF with FFmpeg by mbrubeck on Monday March 16, 2015 @07:46PM (#9215320)
> All of the major browser engines are open-source.

In a world where Internet Explorer is not a major browser.

Re:High quality GIF with FFmpeg by eridius on Monday March 16, 2015 @07:50PM (#9215333)
Hah, I can't believe I actually forgot Internet Explorer was still around. Good point.
Re:High quality GIF with FFmpeg by wukerplank on Monday March 16, 2015 @06:02PM (#9214744)
While GIF is surely inferior to short looped videos, it's still ahead in terms of usability/portability: Drag & drop the file to the desktop and re-upload elsewhere (or embed in your own website). AFAIK this experience is unmatched by web video.
Re:High quality GIF with FFmpeg by 1ris on Monday March 16, 2015 @06:05PM (#9214761)
Global support for h.264 video in the browser: over 90%. And on the desktop it's close to 100%. That's IMO just good enough.
Re:High quality GIF with FFmpeg by wukerplank on Monday March 16, 2015 @06:40PM (#9214960)
That's not what I was referring to. Yes, technically videos are superior, no doubt. The nice thing about GIFs is though that they are treated like images by the browser and the OS. That makes them easier to handle by non-technical users (think imgur, Tumblr, etc.).
Re:High quality GIF with FFmpeg by 1ris on Monday March 16, 2015 @07:45PM (#9215308)
I just realised that imgur does not support webm. I thought it does. Thats kind of stupid. For other websites it'd be as simple as adding a mime type to the list of accepted uploads. Unfortunalty you are right, right now webm is still exotic.
Re:High quality GIF with FFmpeg by acdha on Tuesday March 17, 2015 @09:46AM (#9217825)
WebM is dying – since Microsoft and Apple aren't implementing it, you're basically asking whether it's worth doubling your file storage to support a format available in maybe 60% of browsers versus one supported by 90%:

http://caniuse.com/#feat=webm http://caniuse.com/#feat=mpeg4

That's even more compelling when you remember that the only browser which had releases with support for WebM but not H.264 is Firefox and that's been phasing out for awhile: support for H.264 shipped in FF21 on Windows, FF26 on Linux and FF35 on OS X.

Unless you have a lot of Mac users who don't upgrade, it's probably not worth the hassle particularly since WebM doesn't compress as well as H.264. If VP9 ships that story could change if it delivers an advantage over H.265 compelling enough to get Microsoft or Apple to integrate it or the larger video sides to add it to their toolchain. For most places it'd have to be really compelling to be worth nearly doubling their storage costs.

Re:High quality GIF with FFmpeg by Springtime on Monday March 16, 2015 @10:39PM (#9215963)
I've seen WebMs on Imgur. When saved and opened to check the encoding some are VPx, while others are h.264 encoded in a WebM container.

I can probably find some links later. As I see no option to upload video directly I'm wondering if it requires an account, or whether it was their new(ish) GIF conversion process (IIRC some look like original videos though).

Re:High quality GIF with FFmpeg by 1ris on Tuesday March 17, 2015 @08:27AM (#9217431)
You can't upload webms tough.
Re:High quality GIF with FFmpeg by voltagex_ on Monday March 16, 2015 @09:53PM (#9215815)
The silly thing is if you have a gif and change the URL on imgur to read ".gifv" you'll get WebM!
Re:High quality GIF with FFmpeg by acdha on Monday March 16, 2015 @07:42PM (#9215291)
.mp4 is also well supported by modern operating systems. The only place where there's a problem would be a website which allows you to upload images but not videos.

I'm inclined to say that the enormous compression wins are worth getting the remaining stragglers to upgrade (both of the sites you mentioned already do this, for example, as do other common targets like Twitter, Facebook, etc.).

Re:High quality GIF with FFmpeg by dilap on Monday March 16, 2015 @11:22PM (#9216096)
GIF autoplays inline in the page. Video doesn't (it animates on tap w/ all other content obscured). (On the iPhone, anyway.)

Makes it completely unsuitable for many uses of GIF.

Would love to be wrong or out of date on this, so feel free to let me know if I am ;)

Re:High quality GIF with FFmpeg by coldpie on Tuesday March 17, 2015 @09:28AM (#9217703)
Aside: if you disagree with this philosophy and do not want GIFs to auto-play, there's a very handy Firefox extension to accomplish just that: https://addons.mozilla.org/en-US/firefox/addon/toggle-animat...

I find it makes reading the web a much more pleasant experience.

Re:High quality GIF with FFmpeg by joosters on Monday March 16, 2015 @09:00PM (#9215628)
A large proportion of browsers won't auto-play video, but will auto-play GIFs, so that rules out many uses.

Also, I'd bet that video tags eat memory. A web page with ten animated GIFs might make the user puke, but a web page with ten auto-play videos will likely make the web browser puke :)

Re:High quality GIF with FFmpeg by scrollaway on Monday March 16, 2015 @09:13PM (#9215688)
> I'd bet

No, you're wrong. You have this preconception that videos are obligatorily 300 megabytes or something.

There's virtually no reason for in-hardware decoding of a smaller file to make the browser struggle more than with gifs, which are much less optimized and never in-hardware.

Re:High quality GIF with FFmpeg by billyhoffman on Monday March 16, 2015 @07:57PM (#9215370)
Yes, but the cost is tremendous. First there is the bandwidth. Next it's the hardware: Virtually all mobile Systems-of-a-chip have hardware support for JPEG, PNG, H264, etc decoding. Power-wise animated GIFs are terrible.
Re:High quality GIF with FFmpeg by erikano on Tuesday March 17, 2015 @05:00AM (#9216881)
Don't forget Ogg/Theora.

http://caniuse.com/#feat=ogv