Automatically download camera footage to local NAS storage using two modes: scheduled time-based backups or incident-driven alert-based downloads.
This Python script provides comprehensive backup capabilities for Rhombus camera systems, supporting both proactive scheduled backups and reactive incident response through policy alert integration.
- π¨ Alert-Based Downloads: Automatically capture footage when policy alerts are triggered
- π Manual Time-Based Downloads: Schedule regular backups for specific time periods
- π§΅ Multi-threaded Processing: Concurrent downloads for improved performance
- π΅ Audio Integration: Combines video and audio streams when available
- π Smart File Naming: Organized output with metadata-rich filenames
- π Network Flexibility: Supports both LAN and WAN connections
# Clone or download the repository
git clone <repository-url>
cd backup-alerts-local
# Install Python dependencies
pip install -r requirements.txt
# Install FFmpeg (system dependency)
# macOS: brew install ffmpeg
# Ubuntu: sudo apt install ffmpeg
# Windows: Download from https://ffmpeg.org/
- Log into your Rhombus Console
- Navigate to Settings β API Management
- Create a new API key
- Copy the API key for use in commands
Download footage from recent alerts:
python3 copy_footage_script_threading.py -a YOUR_API_KEY --alerts
Download last hour of footage:
python3 copy_footage_script_threading.py -a YOUR_API_KEY
-a, --api_key
: Your Rhombus API key
--alerts, -al
: Enable alert-based download mode--max_alerts, -ma
: Maximum alerts to retrieve (default: 100)--alert_buffer, -ab
: Buffer seconds before/after alert (default: 30)--before_time, -bt
: Only get alerts before timestamp (epoch seconds)--after_time, -at
: Only get alerts after timestamp (epoch seconds)
--start_time, -s
: Start time in epoch seconds (default: 1 hour ago)--duration, -u
: Duration in seconds (default: 3600)
--location_uuid, -loc
: Filter by location UUID--camera_uuid, -cam
: Filter by camera UUID--usewan, -w
: Use WAN connection for remote access--debug, -g
: Enable detailed debug logging
# Download all recent alerts
python3 copy_footage_script_threading.py -a YOUR_API_KEY --alerts
# Download alerts from last 24 hours with 1-minute buffer
python3 copy_footage_script_threading.py -a YOUR_API_KEY --alerts \
--after_time $(date -d '24 hours ago' +%s) --alert_buffer 60
# Download alerts from specific camera
python3 copy_footage_script_threading.py -a YOUR_API_KEY --alerts \
--camera_uuid CAMERA_UUID --debug
# Download last hour from all cameras
python3 copy_footage_script_threading.py -a YOUR_API_KEY
# Download 2-hour period from specific camera
python3 copy_footage_script_threading.py -a YOUR_API_KEY \
-s 1672531200 -u 7200 -cam CAMERA_UUID
# Download from location via WAN
python3 copy_footage_script_threading.py -a YOUR_API_KEY \
-loc LOCATION_UUID -w
backup-alerts-local/
βββ copy_footage_script_threading.py # Main script
βββ rhombus_logging.py # Custom logging
βββ rhombus_mpd_info.py # MPD parser
βββ requirements.txt # Dependencies
βββ README.md # This file
βββ CLAUDE.md # Claude Code guidance
βββ Copy_Footage_Notes.md # Detailed implementation guide
βββ knowledge/
βββ general-noates.md # API endpoint info
requests>=2.25.1
urllib3>=1.26.0
ffmpeg-python>=0.2.0
- Python: 3.6 or higher
- FFmpeg: For audio/video processing
- Network: Stable connection to Rhombus API
- Storage: ~50MB per minute of HD footage
CameraName_uuid123_1672531200_video.mp4 # Video only
CameraName_uuid123_1672531200_videoWithAudio.mp4 # Video + Audio
CameraName_uuid123_20240101_143022_alert_motion_alert456_video.mp4 # Video only
CameraName_uuid123_20240101_143022_alert_motion_alert456_combined.mp4 # Video + Audio
Filename Components:
- CameraName: Sanitized camera name
- uuid123: Camera UUID
- 20240101_143022: Timestamp (YYYYMMDD_HHMMSS)
- motion: Alert type
- alert456: Alert ID
Add to crontab (crontab -e
):
# Hourly alert check
0 * * * * cd /path/to/script && python3 copy_footage_script_threading.py -a YOUR_API_KEY --alerts
# Daily backup at 2 AM
0 2 * * * cd /path/to/script && python3 copy_footage_script_threading.py -a YOUR_API_KEY -s $(date -d 'yesterday 00:00:00' +%s) -u 86400
# Check recent downloads
ls -la *.mp4 | head -10
# Monitor disk usage
df -h .
# Check for errors
tail -f /var/log/rhombus-backup.log | grep -i error
Issue | Solution |
---|---|
"No policy alerts found" | Check time filters and alert policies |
"Alert missing timestamp" | Enable debug mode to see malformed alerts |
"Failed to retrieve alerts" | Verify API key permissions |
FFmpeg errors | Install FFmpeg and ensure PATH access |
python3 copy_footage_script_threading.py -a YOUR_API_KEY --alerts --debug
Debug output includes:
- API response data
- Alert processing steps
- Download progress
- Detailed error messages
- Copy_Footage_Notes.md: Complete implementation guide
- CLAUDE.md: Claude Code development guidance
- Rhombus API Docs: Official API documentation
Monitor business locations during operating hours with automatic incident capture.
High-frequency monitoring for theft prevention with extended context buffers.
Safety incident documentation with location-specific filtering.
Centralized footage backup across multiple locations.
- Threading: 4 concurrent workers (configurable)
- Rate Limiting: 0.1s delay between requests
- Storage: ~50MB per minute (HD), ~150MB (4K)
- Bandwidth: Optimized for both LAN and WAN usage
- API key authentication
- HTTPS connections to Rhombus API
- Optional certificate-based authentication
- Secure federated session tokens
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Enable debug mode with
--debug
- Check the detailed implementation guide
- Review API permissions and connectivity
- Contact Rhombus support with debug logs
π‘ Pro Tip: Start with alert mode (
--alerts
) for automatic incident capture, then use manual mode for specific investigations. This combination provides comprehensive security coverage.
- β Added alert-based download functionality
- β Implemented configurable buffer times
- β Enhanced multi-threading support
- β Improved error handling and logging
- β Added production deployment guidance