Build a Raspberry Pi time-lapse camera
ActivitiesProjects
Schedule a camera to take repeated photos and turn the frames into a clip of a slow change.
Building a Raspberry Pi time-lapse camera means wiring a camera board to the Pi, shooting a steady sequence of still photographs at regular intervals, and combining those frames into an accelerated video. Different subjects test different paces of change, from drifting clouds, traffic, and star trails to a sunrise, a sunset, or a plant blooming and growing. In a 15 May 2013 example, DesignSpark produced a time-lapse video of shifting weather and a double rainbow using a then-new Raspberry Pi camera board, with Andrew Back credited for the video and tutorial.
Wiring the camera and checking the connector
Always connect the Camera Module or High Quality Camera before switching the Raspberry Pi on. Check the board's port before gathering parts, because connector size varies across models: the Raspberry Pi Zero series, Compute Module IO boards, and flagship boards from Raspberry Pi 5 onward use a 22-pin CSI connector, so a Pi Zero requires a narrower ribbon cable or an adapter.
At each connector, open the retaining flap, seat the ribbon cable straight and firmly with its metallic contacts facing away from the flap, and close the flap. Keep the flexible ribbon from bending at a sharp angle, since a poor connection can prevent the camera from working.
Mounting, focus, and taking a test shot
Keep the camera still throughout the shoot so the framing stays consistent from the first frame to the last. When the best vantage point is away from a monitor and keyboard, you can log in and control the Raspberry Pi remotely over SSH.
Before starting a full sequence, take a single test photograph to check framing, light, and focus. Camera Module V1 and V2 use fixed focus, whereas Camera Module V3 offers continuous autofocus. Exposure runs automatically by default, though light can still shift over the course of a shoot.
Choosing intervals and capturing the stills
Match the pause between photographs to how quickly the scene moves: slower subjects allow longer gaps, while faster movement such as traffic or people needs shorter intervals so motion does not look disjointed. The total duration and capture interval determine how much real time the camera samples, and the number of usable stills plus the playback frame rate set the approximate length of the finished video. At 10 frames per second, 300 usable frames make about 30 seconds of video when each photograph displays for one frame.
Two methods handle the shooting: the camera app's built-in time-lapse mode, or a separate `cron` schedule:
- Built-in time-lapse mode: On Raspberry Pi OS Bookworm and later, the camera applications use `rpicam-*` names such as `rpicam-still` (older tutorials may use `libcamera-still`). You create a destination folder, set a total timeout and interval in milliseconds, and supply a numbered filename pattern such as `timelapse/image%04d.jpg`. Check the saved folder rather than assuming the total from simple division; a 30,000-millisecond run with a 2,000-millisecond interval can produce 14 files (`image0000.jpg` through `image0013.jpg`).
- A separate `cron` schedule: Rather than leaving `rpicam-still` running in time-lapse mode, you can put a timestamped `rpicam-still` command in an executable shell script and add a `crontab` entry so `cron` runs it automatically on a schedule, such as once per minute, saving JPEGs into a dedicated directory. Removing that `crontab` line stops the schedule.
Turning the stills into a video
Once the photographs are collected, FFmpeg combines either a wildcard match (`timelapse/*.jpg`) or a numbered image sequence into a video at a chosen input frame rate. A standard assembly scales the images to 1280×720 and encodes an MP4 file using x264 at 10 frames per second.
Encoding speed depends on both the Raspberry Pi model and the number of photographs. When a long shoot produces a large batch of stills, transferring the image folder to a more powerful computer for video compilation is a practical alternative.
