Live data from Hacker News

Make timelapses easily using FFmpeg

news.ycombinator.com

21–30 of 80 posts

Re: Make timelapses easily using FFmpeg

#21
I looked into using ffmpeg to “compress” video podcasts by lowering the framerate a lot, but it didn’t seem to do as much as I thought (about 50% size reduction). The theory was that a video podcast is mostly talking heads with an occasional chart on the screen, so you really only need a frame every second, or five seconds.

Re: Make timelapses easily using FFmpeg

#22

I wanted to print out one of those flipbooks I had as a kid, where the frames are printed and as the pages are flipped it looks like a movie. Is that something ffmpeg could do? Is there any good resource for recipes like these?

try

    ffmpeg -ss 00:01:00 -i input.avi -t 30 -vf "fps=1,scale=320:-1:flags=lanczos" output_%04d.jpg
00:01:00 is where to start the flip book, 30 is thirty seconds worth, and 1 fps is how many frames per second. this'll make output_XX.jpg from the Avi which you can then print

Re: Make timelapses easily using FFmpeg

#23
post #21

I looked into using ffmpeg to “compress” video podcasts by lowering the framerate a lot, but it didn’t seem to do as much as I thought (about 50% size reduction). The theory was that a video podcast is mostly talking heads with an occasional chart on the screen, so you really only need a frame every second, or five seconds.

AV1 exceeds at these type of videos. It's why so many anime people use it.

Try encoding the video to AV1 with OPUS audio. You'll get ridiculous gainz!

My command is:

    $ffmpegPath -i $_.FullName -r 23.976 -vf scale=1280:720 -c:v libsvtav1 -pix_fmt yuv420p10le -crf 30 -preset 10 -g 300 -c:a libopus -b:a 96k -ac 2 -c:s copy -map 0 $destPath

Re: Make timelapses easily using FFmpeg

#24
back when computers were hard, tips like this were gold. but these days, for for a well trod/documented thing like ffmpeg, asking ChatGPT to make the ffmpeg command you want works really well, eg "give me ffmpeg to make a video from a series of jpegs" and iterate from there.

Re: Make timelapses easily using FFmpeg

#25

Where FFMPEG really shines is stabilising video. Unfortunately not all versions have "vidstab". ffmpeg -i "$1" -vf vidstabdetect=shakiness=5:show=1 dummy.avi ffmpeg -i "$1" -vf yadif, format=yuv420p, vidstabtransform=zoom=2:optzoom=0:crop=black -c:v libx264 -b:a 32k stabilized264.mp4 Yesterweek's shaky video shot from a kayak: https://youtu.be/4pM0VeH4NE0?si=H2qTJfcvis3QmFlj

If you really wish to install all the available options, you can run:

brew install homebrew-ffmpeg/ffmpeg/ffmpeg $(brew options homebrew-ffmpeg/ffmpeg/ffmpeg --compact)

Re: Make timelapses easily using FFmpeg

#26
post #14
post #11

I'd recommend Da Vinci Resolve for making timelapses. It performs really well and let's you scrub through before rendering anything which lets you clip just the part that you need. Plus you get the benefit of high export quality which can be fiddly with ffmpeg.

why is high export quality fiddly with ffmpeg?

there are a bunch of flags to get exactly right in order to get it to give you a high quality image out. there are wrappers to do this more easily for you, ffmpeg is a low level tool.

Re: Make timelapses easily using FFmpeg

#27
post #21

I looked into using ffmpeg to “compress” video podcasts by lowering the framerate a lot, but it didn’t seem to do as much as I thought (about 50% size reduction). The theory was that a video podcast is mostly talking heads with an occasional chart on the screen, so you really only need a frame every second, or five seconds.

AV1 exceeds at these type of videos. It's why so many anime people use it. Try encoding the video to AV1 with OPUS audio. You'll get ridiculous gainz! My command is: $ffmpegPath -i $_.FullName -r 23.976 -vf scale=1280:720 -c:v libsvtav1 -pix_fmt yuv420p10le -crf 30 -preset 10 -g 300 -c:a libopus -b:a 96k -ac 2 -c:s copy -map 0 $destPath

Thanks I will give it a try.

Re: Make timelapses easily using FFmpeg

#28
post #13
post #9

Nice, thanks! I tried using ffmpeg for a minor video editing task I had a few months ago - just a cut, crop, rescale, and volume adjust. I've tried a few of the mainstream GUI video editing tools, and IMO, they all have incomprehensible UIs, are way too bloated, and usually far too expensive for what I'm trying to do. FFmpeg may not be dead simple, but I find it much easier to skim the command line flag list to figur…

Davinci Resolve has a free (as in beer) version that is quite capable and easy to use, even as someone who'd only used iMovie before. The only problem is that "how to do X in Davinci Resolve" has been taken over by slop.

Davinci Resolve is actually the first thing that came to mind on the subject of, okay it's free, that's nice, but I can't for the life of me figure out how to do anything in it. I suppose it's not necessarily their fault that the search results for how to do basic things are garbage, but I guess an advantage of CLI apps is how-to results for them don't seem to attract nearly as much SEOified clickbait.

Re: Make timelapses easily using FFmpeg

#29
post #15
post #9

Nice, thanks! I tried using ffmpeg for a minor video editing task I had a few months ago - just a cut, crop, rescale, and volume adjust. I've tried a few of the mainstream GUI video editing tools, and IMO, they all have incomprehensible UIs, are way too bloated, and usually far too expensive for what I'm trying to do. FFmpeg may not be dead simple, but I find it much easier to skim the command line flag list to figur…

To be fair, pulling out a professional video editor for small changes is like learning emacs to edit some config files. You don't need 99% of the features. Also as an FYI to everyone, FFmpeg does support nVidia GPU acceleration but it might not be enabled in your build. So check if you use it a lot.

Probably true, but ffmpeg seems to have a ton of features too. It seems to me that CLI apps are inherently better at not distracting you with things you don't need. A CLI flag that you don't use is invisible outside of the man pages, not so for a menu or toolbar of a zillion options with names and icons you don't understand.
Post reply on HN