Live data from Hacker News

High quality GIF with FFmpeg

blog.pkh.me

61–70 of 131 posts

Re: High quality GIF with FFmpeg

#61

Earlier quoted context omitted.

I hate the "invention" of Gifv with every ounce of my soul. If it's a Webm or a MP4 file then say so. There are HTML5 tags for them and their looping. The least the Internet needs is a redundant file extension for what has been done by Gfycat and 4chan/8chan for years now.

Unfortunately a VERY large chunk of the web still can't see webm. http://caniuse.com/#feat=webm

Doesn't IE use directshow filters for playback? As long as anything like ffdshow or lavfilters is installed it could just use those.

Afaik firefox uses system-provided h.264 decoders to support that since they don't want to ship one with firefox.

Re: High quality GIF with FFmpeg

#62
post #32

>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://…

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

#63
post #50

Earlier quoted context omitted.

If only iOS (and Android?) allowed you to play inline videos the way you can on the desktop, and the way they play animated GIF's inline. Besides allowing us to adopt video throughout and save on bandwidth and have better video quality, this will be a huge productivity boost to developers: we can finally stop having the GIF vis JIF pronunciation debate.

Unless somebody's producing ads, why would he insist on having the video "inline like on the desktop" on the small screen of the mobile phone?

To replace GIFs. I don't have a problem with users being able to opt out, etc. But GIF's are still useful, yet a huge drain on resources. If for nothing, I want my cat videos still available inline without having to click them.

Re: High quality GIF with FFmpeg

#64

ffmpeg is downright magical - just don't get caught using the one in the Ubuntu/Debian repositories. Compile your own ffmpeg if you have any need to do serious work; the Libav fork just isn't as capable. The reasons are obvious if you look into the development philosophies of the two projects. https://github.com/mpv-player/mpv/wiki/FFmpeg-versus-Libav

> ffmpeg is downright magical

Actually, in my experience, ffmpeg is the linux-program that by far outshines any other program in... failing or crashing :/

I'm sorry to say this. And, unfortunately, there isn't any other open source program doing a better job in terms of file format support.

Re: High quality GIF with FFmpeg

#65
post #32

>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://…

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.

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

#66
post #64

ffmpeg is downright magical - just don't get caught using the one in the Ubuntu/Debian repositories. Compile your own ffmpeg if you have any need to do serious work; the Libav fork just isn't as capable. The reasons are obvious if you look into the development philosophies of the two projects. https://github.com/mpv-player/mpv/wiki/FFmpeg-versus-Libav

> ffmpeg is downright magical Actually, in my experience, ffmpeg is the linux-program that by far outshines any other program in... failing or crashing :/ I'm sorry to say this. And, unfortunately, there isn't any other open source program doing a better job in terms of file format support.

I would agree that ffmpeg has warts. It is pretty poorly documented. Also, filter pipelines are finicky and not commutative, which can be super confusing, but most of the time you don't need them. Aspect ratio syntax is a disaster, but aspect ratio specifications are a little bit of a disaster, so I don't know how much to blame ffmpeg. But simply failing or crashing? I can't say I've ever had a crash that wasn't the result of a misconfiguration on my part.

What's nice is that on linux VLC is basically a QT4 GUI wrapper around ffmpeg, so you can do pretty much whatever you need to do from within VLC.

Re: High quality GIF with FFmpeg

#67

Earlier quoted context omitted.

here's how my quantizer does: full-color, undithered, floyed-dithered: http://imgur.com/a/lrLTd#0 repo: https://github.com/leeoniya/RgbQuant.js demos: http://o-0.me/RgbQuant/ this image is actually a pretty poor example of quantization, it's too easy. full color gradients give a much better indicator of behavior, quality and performance. if you really are interested in different algorithms, check this out: http://www…

That is pretty amazing, thanks for sharing. I am interested in different quantization methods, if only for screenshot usage ( I am working on a remote control product, and the quantization used to be quite poor before I added in octree ). Of course, most of my code is in C# but I can at least take a look at the algorithms, and if they are MIT licensed, I can see what it would take to convert them.

I once won a code golf "popularity contest" competition that was about dithering a grayscale image. The algorithm was perhaps interesting. More so my language of choice: Fortran.

http://codegolf.stackexchange.com/questions/26554/dither-a-g...

Re: High quality GIF with FFmpeg

#68
post #53

So it's using a simple Median Cut quantization... which is okay, but you can get great results using an octree quantizer, and without dithering. Dithering kills your compression savings in GIF so you'd want to avoid it if possible. In any case, you can see the difference a better quantizer makes here: http://www.leptonica.com/color-quantization.html

> Dithering kills your compression savings in GIF Not as much as err-diff if you use custom-palette ordered dithering, since the ordering stays the same from frame to frame the transparent-pixel optimization applies, unlike error diffusion dithering. It's what photoshop uses to create optimized gif, although their particular approach is patented alternative algorithms exist, e.g. http://bisqwit.iki.fi/story/howto/dit…

yeah, error-diffusion dithering is a non-starter for animations. gotta use either pattern or ordered/bayes to eliminate jitter and compress well.

Re: High quality GIF with FFmpeg

#69
post #65

Earlier quoted context omitted.

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.

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.

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.).
Post reply on HN