Live data from Hacker News

Create animated GIF and WebP from videos using FFmpeg

mattj.io

11–20 of 54 posts

Re: Create animated GIF and WebP from videos using FFmpeg

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

The hover previews is an awesome example. Thanks for sharing!

I like collections of commands. However, the challenges that seem unsolved are (1) keeping the example in sync with the CLI options, and (2) making it easy to dig into parts of examples. The former is a classic documentation problem, of course.

Re: Create animated GIF and WebP from videos using FFmpeg

#12

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!

Author here. This is the same journey I went through and I 100% agree! It can be intimidating at first, but FFmpeg is a a worthwhile utility to begin learning. I've also added some shell functions[0] to my dotfiles to make it a bit easier to use when switching between several different machines. [0] https://gist.github.com/devadvance/03d3c8f57b3e0254fb989e946...

You've made a really handy cheat sheet, thanks! Bookmarked it for future use!

And yeah, it's great, and not just for gifs. Just quickly re-encoding something in a different format / container is so much easier than faffing around opening a proper program.

Took a while to not get annoyed with it though and figure out annoying watch-outs like -pix_fmt yuv420p, which I now finally have memorised.

Re: Create animated GIF and WebP from videos using FFmpeg

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

Re: Create animated GIF and WebP from videos using FFmpeg

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

Re: Create animated GIF and WebP from videos using FFmpeg

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

Also, twitter and Facebbok convert uploaded GIFs to video.

Re: Create animated GIF and WebP from videos using FFmpeg

#18
post #9
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…

this is a wonderful idea. we launched a repo here to do exactly this; we'll update the repo over time as we collect commands. https://github.com/HotpotDesign/FFMpeg-Online could we list and credit your commands?

Sure, they're open source for a reason!

The videoprocessing one is more mature. It's been converting various torrents movies to playable mp4s for a few years.

The 10x1s preview looks magical once you see it in production. It's also a great introduction to ffmpeg filter syntax, which really isn't that complex.

Re: Create animated GIF and WebP from videos using FFmpeg

#19
post #18
post #9

Earlier quoted context omitted.

this is a wonderful idea. we launched a repo here to do exactly this; we'll update the repo over time as we collect commands. https://github.com/HotpotDesign/FFMpeg-Online could we list and credit your commands?

Sure, they're open source for a reason! The videoprocessing one is more mature. It's been converting various torrents movies to playable mp4s for a few years. The 10x1s preview looks magical once you see it in production. It's also a great introduction to ffmpeg filter syntax, which really isn't that complex.

thanks! i just wanted to confirm your permission before posting on the repo. :)

on a related note, do you have a command for converting HTML5 animations into webp or mp4 videos?

Post reply on HN