This is a quick and dirty script to create a timelapse using ffmpeg. I have a systemd
timer that takes a snapshots of all my cameras every 5 minutes and dumps them into a folder, which allows me to make some interesting time lapses.
The gist of the script is:
- Uses
find
to locate the first file in the directory, and thenffprobe
to get the resolution of the image. - Uses glob patterns to build a list of all files and runs it through ffmpeg.
filter_complex
is used to hold the last frame for 2 seconds, which can be adjusted with the$FFMPEG_HOLD
variable.
Syntax is below:
make-timelapse.sh <input path as glob> <output file>
Example
make-timelapse.sh "Front-Yard/*/*.jpg" "2021-02-01 Front Yard.mp4"
This was written and tested on ffmpeg version 3.2.14-1~deb9u1
, and this does not work on ffmpeg version 4.2.3
built with gcc for Windows because glob patterns aren't supported. You can get around this by using sequence wildcards, e.g. -i image%03d.jpg
, but that's up to you. This ran fine on Debian under WSL.