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.<p><a href="https://github.com/mpv-player/mpv/wiki/FFmpeg-versus-Libav" rel="nofollow">https://github.com/mpv-player/mpv/wiki/FFmpeg-versus-Libav</a>
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:<p><a href="http://www.leptonica.com/color-quantization.html" rel="nofollow">http://www.leptonica.com/color-quantization.html</a>
>As you probably know, GIF is limited to a palette of 256 colors.<p>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.<p>But this limitation is just another reason not to use it.<p>Can I use Webm?<p><a href="http://caniuse.com/#feat=webm" rel="nofollow">http://caniuse.com/#feat=webm</a><p>Yes, you can, and you should. Or h.264:<p><a href="http://caniuse.com/#feat=mpeg4" rel="nofollow">http://caniuse.com/#feat=mpeg4</a>
I use this shell script for generating gifs out of .mov files: <a href="https://gist.github.com/artursapek/5b3d15ecac5ff75593c4" rel="nofollow">https://gist.github.com/artursapek/5b3d15ecac5ff75593c4</a><p>I can probably improve it further by using some of what's in this article, but it's already faster and better than any online tool I've found.
ffmpeg doesn't get nearly enough credit. As long as you can grok the various settings, it makes you feel like McGyver with a paperclip. We work often with media from unusual sources, and after the first "can we do this with ffmpeg" filter there's very little left to handle.
This is pretty cool. I use GIFs for marketing for my SaaS startup[1] because it has the best support for autoplaying across devices, but the file sizes are a bit high (690 KB and 270KB for screencasts of a few minutes each). I use licecap[2] for recording and Gifsicle for optimizing, but perhaps I should give ffmpeg a go and compare the results.<p>[1] <a href="https://zapla.co" rel="nofollow">https://zapla.co</a><p>[2] <a href="http://www.cockos.com/licecap/" rel="nofollow">http://www.cockos.com/licecap/</a>
This is an interesting discussion, thank you. It would be great to see it compared with the parallel ImageMagick methods: <a href="http://www.imagemagick.org/Usage/anim_opt/" rel="nofollow">http://www.imagemagick.org/Usage/anim_opt/</a>
I wanted to use FFmpeg in an iOS app, but I ran into licensing issues—the FFmpeg wrapper [1] and FFmpeg itself [2] are both LGPL 2.1, which I didn't think you could use in an iOS app.<p>Since this project does exactly that, I took a second look and found a discussion on that specific use case [3]. It didn't quite clarify things, but it looks like it _might_ be legal to use FFmpeg in an app.<p>[1] <a href="https://github.com/OpenWatch/FFmpegWrapper" rel="nofollow">https://github.com/OpenWatch/FFmpegWrapper</a>
[2] <a href="https://www.ffmpeg.org/legal.html" rel="nofollow">https://www.ffmpeg.org/legal.html</a>
[3] <a href="https://trac.ffmpeg.org/ticket/1229" rel="nofollow">https://trac.ffmpeg.org/ticket/1229</a>
Gifsicle is very good at making highly optimized GIFs, but slightly more cumbersome as you have to convert each frame to a separate image first.<p><a href="http://www.lcdf.org/gifsicle/" rel="nofollow">http://www.lcdf.org/gifsicle/</a>
What would be really cool is if ffmpeg/avconv gained the ability to create lossy LZW GIFs, like in this tool:<p><a href="https://github.com/pornel/giflossy" rel="nofollow">https://github.com/pornel/giflossy</a>
Nice article and good job implementing it. I would have preferred a small explanation of the filter graph option (-lavfi), but I guess that's outside the scope of the post.
And to complete the circle, run the gif through Gfycat and check out the mindblowing bandwidth savings:<p><a href="http://gfycat.com/IllustriousHairyGermanpinscher" rel="nofollow">http://gfycat.com/IllustriousHairyGermanpinscher</a><p>GIF: 1 MB<p>Video: 73k