Live data from Hacker News

Make timelapses easily using FFmpeg

news.ycombinator.com

71–80 of 80 posts

Re: Make timelapses easily using FFmpeg

#71
Just dropping this "random" ffmpeg command here, as a reminder that you can turn video files into actual transparent webm using

    ffmpeg -t 5 -i example.mp4 -c:v libvpx-vp9 -b:v 2M -filter_complex "[0:v]chromakey=0x00ff00:0.3:0.2[out]" -map "[out]" -map 0:a stop.webm`
where `example.mp4` is a video with the typical green background.

Maybe someone needs it :)

Re: Make timelapses easily using FFmpeg

#72
ffmpeg works really well for this. I have also been making time-lapse movies for over a decade, starting with using just Quicktime Pro 7 to combine the images into movies. Later using various other tools. Now I also use ffmpeg, and want to keep track of exactly how each movie is put together so looked for a way to script each movie. Now I use ffmpeg-python (not a lot of recent updates, but just works) to steer ffmpeg, with my own time-lapse specific Python package https://pypi.org/project/time-lapse/ to assemble the movies, and for each movie I have a single script which describes which frames are part of it and how they are combined into a movie; https://github.com/153957/time-lapse-scripts I am quite happy with the setup, making it easy to recreate movies in the future from source, but at higher resolutions or different codecs.

Re: Make timelapses easily using FFmpeg

#73
post #53

What does -framerate do here? The manual is not turning up anything, other than it's similar to -r for certain input formats.

It sets the framerate for the input video. The default for the image2 demuxer is 25.

Oh I see, I had assumed that they'd want a much slower speed, but they actually show 30 different input images per second in the 30 fps video.

Re: Make timelapses easily using FFmpeg

#74

Earlier quoted context omitted.

I shoot RAW from an older Canon 5D which Resolve does not read natively. So there's a bit of a conversion step going from CR2. My typical workflow is to use Adobe RAW to process the images, then import the RAW directly to AE to render out with whatever repositioning or cropping. Let's not forget LR Timelapse[0] as part of the workflow too. [0] https://lrtimelapse.com/

I was reading about how to create timelapses on a canon dslr and someone pointed out that each frame you take adds to your shutter count and consumes the lifetime of your shutter. Do you find that a problem? For example a frame every 2 seconds for 8 hours is 14,400 actuations of the shutter.

I worry about my shutter count like I worry about my HN points...I don't. If the shutter was to fail from "too many" clicks, it can replaced. It's not the end of the world. There are people that will point out that you can die every time you drive your car, but does that prevent you from driving your car? I easily have over 150k (I don't have the right cable/adapters available at the moment to confirm the number USB-C to USB-mini) to get actual number. Even if the shutter were to fail, I'd just have it replaced for less than the price of a new body.

Re: Make timelapses easily using FFmpeg

#75
post #47

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

How about $ ffmpeg-english "capture video from the camera every 1 second and write it to jpg files" $ ffmpeg-english "take all of the images ending with .jpg in this directory and make a 30fps timelapse of it" Sound awesome? Here's the code for ffmpeg-english: #!/usr/bin/env python3 import openai import sys import os import time # Ensure you have set your OpenAI API key as an environment variable openai.api_key = os.…

Honestly, ffmpeg is awesome enough being able to do what it can with a one-liner..

And all without python dependency, or even internet access.

Re: Make timelapses easily using FFmpeg

#76
post #62

I took photos every few minutes for about a year. I wrote some custom code to pick out a set of frames from several consecutive days, but with the sun at the same angle in the sky. I then blended these frames together. This makes a ghostly look, without the bright flashes of cloud passing or weather changing. As I moved forward in time, I selected frames from the next angle in the sky, so it looks like only a day pas…

Very cool! We tried to do the same thing with a series of photos taken along the solar eclipse, but didn't have enough density or consistency to make it compelling.

Re: Make timelapses easily using FFmpeg

#77
post #33

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.

Please don't let this line of thinking put you (the reader) off sharing tips. Here we now have a thread containing other information we may not have thought to ask anyone/thing about, discussion, history, etc.

teach to fish vs giving of fish, I suppose. I did not mean to discourage or stifle discussion, but point out that there's a tool that makes it much easier to get the right incantation of ffmpeg.

Re: Make timelapses easily using FFmpeg

#78
post #47

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

How about $ ffmpeg-english "capture video from the camera every 1 second and write it to jpg files" $ ffmpeg-english "take all of the images ending with .jpg in this directory and make a 30fps timelapse of it" Sound awesome? Here's the code for ffmpeg-english: #!/usr/bin/env python3 import openai import sys import os import time # Ensure you have set your OpenAI API key as an environment variable openai.api_key = os.…

[deleted]

Re: Make timelapses easily using FFmpeg

#79

Is there a variant that encodes ProRes lossless? I usually open them up in a new project just to create a lossless input video to work with in After Effects, and use that (if I use image sequence directly, DaVinci Resolve acts in weird ways). ffmpeg might ease that AE part.

ffmpeg has 2 prores encoders

Re: Make timelapses easily using FFmpeg

#80
post #62

I took photos every few minutes for about a year. I wrote some custom code to pick out a set of frames from several consecutive days, but with the sun at the same angle in the sky. I then blended these frames together. This makes a ghostly look, without the bright flashes of cloud passing or weather changing. As I moved forward in time, I selected frames from the next angle in the sky, so it looks like only a day pas…

This is awesome. What kind of hardware are you using? If you don't mind.
Post reply on HN