From watching a delicate flower bloom across forty-eight hours to capturing the slow construction of a timber greenhouse, automated photography reveals hidden dimensions of time. While commercial action cameras can record basic time-lapse video, they suffer from short battery endurance, limited storage capacity, and closed proprietary software that cannot be scripted or triggered by external environmental sensors.

A Raspberry Pi paired with an official Camera Module creates an exceptionally flexible, permanent automated photography station. With full control over exposure times, focus distances, White Balance, and capture intervals, you can create breathtaking, flicker-free time-lapse sequences that render into cinematic 4K video.

This guide covers selecting between the Camera Module 3 and HQ Camera, connecting ribbon cables safely, utilizing the modern rpicam-still (libcamera) command-line interface, locking manual exposure to eliminate frame flicker, scheduling automated captures with cron, and compiling thousands of raw frames into smooth MP4 video using ffmpeg.

Camera hardware planning and optical selection

The Raspberry Pi ecosystem supports several generations of camera sensors:

  • Raspberry Pi Camera Module 3 (Recommended for General Use): Features a 12-megapixel Sony IMX708 sensor with native Phase Detection Autofocus (PDAF) and High Dynamic Range (HDR) capture mode. It is compact, lightweight, and comes in both standard (75° FoV) and wide-angle (120° FoV) variations.
  • Raspberry Pi High Quality (HQ) Camera (Best for Professional Optics): Features a 12.3-megapixel Sony IMX477 sensor with an interchangeable C/CS lens mount. It accepts professional manual zoom lenses, macro optics, and optical telephotos, making it ideal for distant horizon time-lapses or macro plant growth studies.
  • Raspberry Pi Board: A Raspberry Pi 4, 5, or Zero 2 W running 64-bit Raspberry Pi OS. Note that the Raspberry Pi 5 uses a smaller, high-density 22-pin camera connector and requires a dedicated mini-to-standard camera adapter cable.
  • Storage Strategy: High-resolution 12 MP images weigh ~3 to 5 MB per frame. A 2,000-frame time-lapse requires roughly 8 to 10 GB of storage. Use a high-capacity 64 GB+ microSD card or an external USB 3.0 SSD.

Connecting the camera module safely

Important: Always disconnect power from the Raspberry Pi before attaching or detaching the camera ribbon cable. Connecting a camera while the board is powered can short the sensitive CSI receiver lanes.

  1. Locate the camera port (labelled CAM or CAMERA) on your Raspberry Pi.
  2. Gently lift the plastic retaining collar of the CSI connector upward.
  3. Insert the ribbon cable with the metallic contacts facing the correct direction:
  4. On Pi 4 and older boards: the silver contacts face toward the HDMI ports; the blue backing strip faces toward the Ethernet/USB ports.
  5. On Pi 5: the silver contacts face toward the board's interior copper circuitry.
  6. Press the plastic collar down firmly to lock the ribbon cable in place.
  7. Reconnect power to the Raspberry Pi.

Verify that the camera sensor is detected by the operating system kernel:

BASH
rpicam-hello --list-cameras

The terminal will report the detected camera model (e.g., imx708 [12.29 MP]).

The Golden Rule of Time-Lapse: Eliminating Frame Flicker

The most common mistake in time-lapse photography is leaving the camera on automatic exposure (auto). In automatic mode, the camera re-evaluates scene brightness for every single photo. A passing cloud or subtle light shift causes the camera to adjust shutter speed or analog gain, resulting in jarring, strobing frame flicker in your final video.

To achieve cinematic, smooth results, you must lock the optical parameters manually: - Shutter Speed (--shutter): Lock the exposure time in microseconds (e.g., --shutter 20000 for 1/50th of a second). - Gain (--gain): Set a fixed ISO/gain value (e.g., --gain 1.0 or --gain 2.0) to avoid digital sensor noise fluctuations. - White Balance (--awb): Never leave white balance on auto. Lock it to a fixed color temperature preset (e.g., --awb daylight or --awb incandescent). - Autofocus (--autofocus-mode manual): On Camera Module 3, set the focus distance to a fixed diopter measurement (e.g., --lens-position 0.0 for infinity) so the lens does not hunt for focus between frames.

Capturing test frames with rpicam-still

Test your manual exposure settings:

BASH
rpicam-still --nopreview   --output test.jpg   --shutter 20000   --gain 1.0   --awb daylight   --autofocus-mode manual   --lens-position 0.0

Inspect test.jpg on your computer or mobile device. Adjust the --shutter value until the image is properly exposed.

Method 1: Using rpicam-still built-in time-lapse mode

For continuous captures spanning a few hours, rpicam-still features a built-in time-lapse execution flag (--timelapse):

BASH
mkdir -p "$HOME/timelapse/frames"
cd "$HOME/timelapse"

rpicam-still --nopreview   --timelapse 5000   --timeout 7200000   --output "frames/frame_%05d.jpg"   --shutter 20000   --gain 1.0   --awb daylight   --autofocus-mode manual   --lens-position 0.0
  • --timelapse 5000: Captures one photo every 5,000 milliseconds (5 seconds).
  • --timeout 7200000: Runs continuously for 2 hours (in milliseconds).
  • --output "frames/frame_%05d.jpg": Automatically writes sequentially numbered files (frame_00001.jpg, frame_00002.jpg, etc.).

Method 2: Long-term scheduling with cron

For multi-day or multi-week captures (such as architectural builds or plant growth), use a standalone capture script scheduled via cron.

Create a capture script:

BASH
mkdir -p "$HOME/timelapse/scripts" "$HOME/timelapse/photos"
nano "$HOME/timelapse/scripts/take_photo.sh"

Paste the following script:

BASH
#!/bin/bash
DATE=$(date +"%Y%m%d_%H%M%S")
rpicam-still --nopreview   --output "$HOME/timelapse/photos/img_${DATE}.jpg"   --shutter 20000   --gain 1.0   --awb daylight   --autofocus-mode manual   --lens-position 0.0

Make the script executable:

BASH
chmod +x "$HOME/timelapse/scripts/take_photo.sh"

Open crontab -e and schedule the script to run once every 10 minutes between 7:00 AM and 7:00 PM:

TEXT
*/10 7-19 * * * /home/pi/timelapse/scripts/take_photo.sh > /dev/null 2>&1

Compiling frames into 4K video with FFmpeg

Once your capture sequence is complete, compile the raw image sequence into a video using ffmpeg:

Install FFmpeg:

BASH
sudo apt update
sudo apt install -y ffmpeg

Render the sequentially numbered frames into a high-bitrate 4K MP4 video:

BASH
cd "$HOME/timelapse/frames"

ffmpeg -r 30 -f image2 -pattern_type glob -i "*.jpg"   -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p   -movflags +faststart output_timelapse.mp4
  • -r 30: Renders the output at 30 frames per second. (A 900-photo sequence yields a smooth 30-second video).
  • -c:v libx264: Encodes using the high-compatibility H.264 video codec.
  • -crf 18: Constant Rate Factor 18 produces visually lossless output quality.
  • -pix_fmt yuv420p: Ensures playback compatibility with all modern browsers, QuickTime, and mobile phones.

Monitor your camera station with Open Pi

Long-term time-lapse stations are often installed in attics, greenhouses, or outdoor weatherproof enclosures.

With Open Pi on your iOS or Android phone: - Storage Space Monitoring: Ensure thousands of high-resolution images do not fill your storage drive unexpectedly. - Thermal & CPU Metrics: Monitor temperature levels inside sealed camera enclosures. - System Uptime: Verify that the Raspberry Pi has not rebooted during a critical capture sequence.

Troubleshooting time-lapse captures

  • No cameras available Error: Ensure the ribbon cable is seated squarely in the CSI connector and that the retaining clip is clicked down. On Raspberry Pi 5, verify that you are using the correct 22-pin camera adapter cable.
  • Images Are Blurry or Out of Focus: On Camera Module 3, autofocus can hunt in low light. Use manual lens positioning (--autofocus-mode manual --lens-position X) to dial in the exact focal plane.
  • Camera Sensor Overheating in Sunlight: Direct sunlight on outdoor cases can cause camera sensor noise and thermal shutdown. Use white, UV-reflective weatherproof enclosures with ventilation weep holes.

Sources and further reading

Open Pi logo
Monitor your Raspberry Pi from your phone

Check real-time CPU, RAM, temperature, and service health for your creative projects projects with Open Pi for iOS and Android. Local-first, private, and no cloud account required.

Explore Open Pi App StoreGoogle Play
About this guide

Researched and validated against official project documentation and community standards on September 11, 2026. Review your board model, storage, and current release notes before deploying.