Live data from Hacker News

Create animated GIF and WebP from videos using FFmpeg

mattj.io

21–30 of 54 posts

Re: Create animated GIF and WebP from videos using FFmpeg

#21
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.

Re: Create animated GIF and WebP from videos using FFmpeg

#22
post #14
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.

Agreed. I think people see little video clips and think "oh, a GIF" without realizing that imgur, giphy, etc. don't actually use GIFs.

While they might not know the specific term, they do know that something is different with those services b.c. they can’t save the ‘gif’ videos as easily as they can with real gifs.

Re: Create animated GIF and WebP from videos using FFmpeg

#23
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.

Will the file autoplay and loop according to the same rules everywhere I view it after I right-click and save it? Because that is what people liked about animated gifs. It's like you're telling people to drive a car instead of riding a bike. They have some crossover in functionality but they're not the same thing.

Re: Create animated GIF and WebP from videos using FFmpeg

#24
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…

Thanks for sharing!

I use a collection of commands in a dotfiles [1] repo I share around a few machines.

This [2] command, compresses any video into a small web-playable file with relatively high quality so you can quickly share HD footage.

    ffcompress INPUT.mp4
    # creates INPUT.compressed.mp4
[1] https://github.com/benwinding/dotfiles

[2] https://github.com/benwinding/dotfiles/blob/master/bin/ffcom...

Re: Create animated GIF and WebP from videos using FFmpeg

#25
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.

Will the file autoplay and loop according to the same rules everywhere I view it after I right-click and save it? Because that is what people liked about animated gifs. It's like you're telling people to drive a car instead of riding a bike. They have some crossover in functionality but they're not the same thing.

Well yeah except GIF isn't a good bike at all, it's a beaten-up Huffy with a rusty chain, worn-down brake pads, leaky tire, and a torn-up seat.

Re: Create animated GIF and WebP from videos using FFmpeg

#26
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…

https://github.com/tldr-pages/tldr is a large collection

Re: Create animated GIF and WebP from videos using FFmpeg

#27

WTF is an animated WebP? Shouldn't it be just a normal WebM video?

Not necessarily, as it's treated differently by the browser. Animated WebPs will autoplay without a `muted` or `autoplay` attribute. Under the hood they're no different than a webm video, with the exception of no support for audio tracks.

Re: Create animated GIF and WebP from videos using FFmpeg

#28
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.

> Why would you ever do this?

There are still situations where you want a gif. Your approach works fine if you're writing your own code, but if I want to embed a looping animation on a Confluence page, it isn't a viable option.

Re: Create animated GIF and WebP from videos using FFmpeg

#30
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.

The articles end goal is not animated GIF files for the sole purpose of putting them on websites. Whether you like it or not, there are still plenty of scenarios where using a GIF file is necessary, Evernote for example only supports embedding animated GIFs not webm or any kind of proper video codec.
Post reply on HN