[HN Gopher] Create animated GIF and WebP from videos using FFmpeg ___________________________________________________________________ Create animated GIF and WebP from videos using FFmpeg Author : Audiolite Score : 56 points Date : 2021-02-28 19:35 UTC (3 hours ago) (HTM) web link (mattj.io) (TXT) w3m dump (mattj.io) | canada_dry wrote: | Handy guide, thx! | | A bit overkill but, a gui to hand-hold old folks like me would | handy. Perhaps an addin for blender could work - since it's video | handling chops are growing bigger every day? | | > I'm an engineering manager at Google Stadia | | That's gotta be an interesting gig! | [deleted] | eneve wrote: | I use something similar in MetaMeme for Android | devadvance wrote: | Are you using FFmpeg or directly using libavcodec (or similar)? | bitsen wrote: | How about APNG? | dheera wrote: | Oh please no. Why would you ever do this? Please use the <video> | 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? | <video width="320" height="240" autoplay loop playsinline muted> | <source src="foo.mp4" type="video/mp4"> <source | src="foo.ogg" type="video/ogg"> <!-- GIF fallback for | ancient browsers but it's 2021 and you probably don't need this | anymore --> <img src="foo.gif" width="320" | height="240"> </video> | | 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. | sp332 wrote: | Agreed. I think people see little video clips and think "oh, a | GIF" without realizing that imgur, giphy, etc. don't actually | use GIFs. | ourcat wrote: | Also, twitter and Facebbok convert uploaded GIFs to video. | jonplackett wrote: | 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! | devadvance wrote: | 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... | jonplackett wrote: | 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. | nicbou wrote: | 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 is how I create hover previews like on modern streaming | sites: | | https://github.com/nicbou/timeline/blob/9d9340930ed0213dffdd... | | [1] http://bropages.org/tar | panabee wrote: | 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? | devadvance wrote: | 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. ___________________________________________________________________ (page generated 2021-02-28 23:00 UTC)