Live data from Hacker News

Create animated GIF and WebP from videos using FFmpeg

mattj.io

31–40 of 54 posts

Re: Create animated GIF and WebP from videos using FFmpeg

#31
post #13

Oh please no. Why would you ever do this? Please use the tag to embed your actual video with a GIF fallback if you wish. Why are we using an ancient 8-bit lossless format for video when pretty much all browsers support video embeds these days? With H.264 or any modern codec you'll get 24-bit color and smaller file sizes than GIF. It's better in every way I can imagine.

GIFs are nice for short looping clips, because they can be embedded anywhere and they don't glitch out unexpectedly like every single "using videos as gifs" solution out there.

Animated WebPs also can do that but significantly better. And they are supported by all browsers now.

Re: Create animated GIF and WebP from videos using FFmpeg

#32

I switched to ffmpegging my gifs a year ago and haven't looked back. It's a bit annoying to begin with but now so much easier than using some 3rd rate program or having to upload everything to EZGif. It's worth the pain!

If you start from .png files I struggled to get ffmpeg to produce a high quality gif, and had much more luck with imagemagick.

Re: Create animated GIF and WebP from videos using FFmpeg

#34
post #7

Perhaps it's time to start a collection of ffmpeg commands for every situation, similar to bro pages [1]. I feel like I have to look at my old projects every time I need to use it. It took me a lot of trial and error to write an all-purpose ffmpeg command. This is how I convert videos to 720p web-playable videos (if it's not already web-playable): https://github.com/nicbou/homeserver/blob/22c0a160f9df5f4c34... This i…

There's always commandlinefu.com - https://www.commandlinefu.com/commands/matching/ffmpeg/ZmZtc...

Re: Create animated GIF and WebP from videos using FFmpeg

#35

What linux disto are you using that’s so similar to macOS?

If you're referencing the GIF of the terminal: it's a small docker image[0] I use to have a consistent demo environment. In this case, I'm running it within iterm on macOS.

[0] https://github.com/devadvance/terminalcheatsheet/blob/stagin...

Re: Create animated GIF and WebP from videos using FFmpeg

#37

Don’t use GIFs for videos.

I really hope that HEIF animations can take the place of GIFs someday. http://nokiatech.github.io/heif/comparison.html

>I really hope that HEIF animations

considering that HEIF is based on HEVC, wouldn't "HEIF animations" just be HEVC videos?

Re: Create animated GIF and WebP from videos using FFmpeg

#38
I found that gifski makes great quality animated gifs. ffmpeg is a mess to use for that. You still need ffmpeg to generate individual frames from a video, but that's a relatively easy step in comparison to that cumbersome set up of dithering for gif generation.

https://gif.ski

Re: Create animated GIF and WebP from videos using FFmpeg

#39
post #37

Earlier quoted context omitted.

I really hope that HEIF animations can take the place of GIFs someday. http://nokiatech.github.io/heif/comparison.html

>I really hope that HEIF animations considering that HEIF is based on HEVC, wouldn't "HEIF animations" just be HEVC videos?

Basically what this commenter said, but substitute WebP and WebM for HEIF and HEVC

https://news.ycombinator.com/item?id=26298606

GIFs have a nice convenience to them that straight-up video files lack

Re: Create animated GIF and WebP from videos using FFmpeg

#40

What linux disto are you using that’s so similar to macOS?

If you're referencing the GIF of the terminal: it's a small docker image[0] I use to have a consistent demo environment. In this case, I'm running it within iterm on macOS. [0] https://github.com/devadvance/terminalcheatsheet/blob/stagin...

Ah, I see, thanks.
Post reply on HN