The Herb Hub timelapse service automates the creation of video recordings from time-series image data. It operates as a background process that continuously monitors an input directory for new images, filters them based on specific criteria, and combines them into high-quality MP4 videos. This service is essential for capturing long-term environmental observations or project progress without manual intervention.

The core functionality relies on two main components: a shell script responsible for the actual video generation and a Docker container that orchestrates its execution. The script, located within the make-timelapse.sh utility, is designed to be flexible and robust, handling various input formats while ensuring data integrity before processing.

Image selection and filtering occur before the video is constructed. The service scans the input directory for image files with common extensions such as JPEG, PNG, and WebP. It determines the timestamp of each image by parsing the filename or using file metadata. Users can restrict the processing window using --from and --to arguments to specify a precise datetime range. Additionally, the system can filter out underexposed frames if the ImageMagick tool is available, ensuring that only adequately lit images contribute to the final video.

The timelapse generation process utilizes FFmpeg as the primary engine for video synthesis. The script creates a temporary list of selected images and their corresponding durations, which are then fed into FFmpeg using the concat demuxer. During this phase, the video is scaled to standard dimensions, encoded using the H.264 codec with configurable quality settings, and output at a target frame rate determined by the input image speed.

The service runs inside a Docker container optimized for minimal resource usage while maintaining performance. The container image is based on Alpine Linux and installs essential utilities including Bash, coreutils, FFmpeg, and ImageMagick. An entrypoint script manages the lifecycle of the timelapse builder, supporting both single-run modes for one-off tasks and loop modes for continuous monitoring over extended periods.

The output video is saved to a designated directory within the container’s filesystem. By default, if no specific filename is provided, the system generates a timestamped file named timelapse-YYYYMMDD-HHMMSS.mp4. This structured output allows Herb Hub users to easily retrieve and analyze their timelapse recordings for documentation or presentation purposes.