Skip to content

mikislin/RPi4Cam

Repository files navigation

RPi4Cam: Scalable Video Recording for Behavioral Neuroscience

RPi4Cam is a flexible, open-source system for controlling multiple Raspberry Pi cameras to record synchronized videos for behavioral neuroscience experiments. It features a central GUI for managing camera operations, including starting/stopping recordings, configuring camera modes, transferring video files, and previewing live streams. The system is designed to be scalable, robust, and easy to use, with support for segmented recordings and clock synchronization verification.

Features

  • Centralized Control: Manage multiple Raspberry Pi cameras from a single Tkinter-based GUI.
  • Recording Management: Start and stop recordings on individual or groups of cameras, with customizable durations and segment lengths.
  • File Management: Transfer recorded sessions (H.264 videos and timestamp files) to a central storage location, with options to delete remote files after transfer.
  • Live Preview: Stream MJPEG video feeds from each camera for real-time monitoring.
  • Clock Synchronization: Verify and synchronize clocks across all Raspberry Pis using chronyc or hardware-based GPIO triggers.
  • Status Monitoring: Real-time updates on camera status, network connectivity, disk space, and recording duration.
  • Modular Architecture: Separates camera service (camera_service.py), GUI (central_control_gui.py), and utilities (gui_utils.py) for maintainability.
  • Open Source: Licensed under the BSD 3-Clause License, allowing free use and modification.

System Requirements

  • Hardware:
    • One or more Raspberry Pi 4 devices with cameras (tested with Raspberry Pi Camera Module 2/3).
    • A central computer (Linux recommended) to run the GUI.
    • Network connectivity between the central computer and Raspberry Pis.
    • Optional: Push-button and wiring for hardware-based clock synchronization (see gpiotest.py).
  • Software:
    • Raspberry Pi OS (64-bit recommended) on each RPi.
    • Python 3.9+ on all devices.
    • Required libraries (see requirements.txt).
    • libcamera and MP4Box installed on the central computer and RPis.
  • Network:
    • A local network with static or known IP addresses for each RPi (see hostnames.csv).
    • SSH access enabled on each RPi with username matching the hostname.

Setup Instructions

  1. Prepare Raspberry Pis:

    • Install Raspberry Pi OS and ensure SSH is enabled.
    • Install required dependencies on each RPi:
      sudo apt update
      sudo apt install -y python3 python3-pip libcamera-apps gpac
      pip install -r requirements.txt
      
  2. Start the camera service:

  3. Prepare the Central Computer:

About

A highly flexible, scalable, video recording system for behavioral neuroscience with RPi4B, PiCam2, LAN

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages