Overview
This guide demonstrates how to backup video and audio footage from Rhombus cameras to local storage devices such as Network Attached Storage (NAS), external hard drives, or local servers. The solution uses a Python script that leverages the Rhombus API to download footage in parallel across multiple cameras. The implementation supports:- Multi-camera downloads with threading for improved performance
- Video and audio synchronization with automatic merging
- Flexible scheduling using cron jobs or task schedulers
- Customizable time ranges for historical footage backup
- Location-based filtering to backup specific sites
How It Works
1
Camera Discovery
2
The script queries the Rhombus API to enumerate all cameras in your organization, filtering by connection status, location, or specific camera UUIDs.
3
Session Authentication
4
A federated session token is generated for each camera, providing temporary (1-hour) credentials for media access without exposing your API key in download URLs.
5
Media Download
6
For each camera, the script:
7
seg_init.mp4)8
Audio-Video Merging
9
If audio is available, the script uses FFmpeg to merge video and audio streams into a single file, then cleans up temporary files.
Prerequisites
Before implementing local backup, ensure you have:- Python 3.7 or higher installed on your backup system
- Rhombus API key from the Rhombus Console
- Network connectivity to Rhombus cameras (LAN or WAN)
- Sufficient storage space on your backup device (estimate 1-2 GB per camera per day)
- FFmpeg installed for audio-video merging
Installation
Install Required Software
- Ubuntu/Debian
- macOS
- Windows
- Synology NAS
Download the Backup Script
Clone the Rhombus API examples repository:Verify Installation
Test that all components are installed correctly:Configuration
Command-Line Parameters
The backup script supports the following parameters:Your Rhombus API key for authentication. Required unless using certificate-based authentication.Example:
--api_key YOUR_API_KEY_HEREUnix epoch timestamp for backup start time. Defaults to 1 hour ago if not specified.Example:
--start_time 1693526400 (August 31, 2023 at 16:00:00 UTC)Duration in seconds to backup from start time. Defaults to 3600 seconds (1 hour).Example:
--duration 7200 (2 hours)Filter backup to cameras at a specific location. Useful for multi-site deployments.Example:
--location_uuid location-uuid-hereBackup footage from a specific camera only.Example:
--camera_uuid camera-uuid-hereUse WAN addresses instead of LAN. Enable when backup system is outside your local network.Example:
--usewanEnable debug logging for troubleshooting.Example:
--debugPath to client certificate for mTLS authentication (advanced use case).Example:
--cert /path/to/cert.pemPath to private key for mTLS authentication (advanced use case).Example:
--private_key /path/to/key.pemUsage Examples
Basic Backup (Last Hour)
Backup the last hour of footage from all cameras:Specific Time Range
Backup footage from a specific 2-hour window:Single Camera Backup
Backup footage from one specific camera:Location-Based Backup
Backup all cameras at a specific location:WAN Access (Remote Backup)
Backup from outside your local network:Debug Mode
Enable detailed logging for troubleshooting:Output Files
Downloaded footage files follow this naming convention:- Video-only files:
.mp4format (when no audio is available) - Merged files:
.mp4format (video + audio combined via FFmpeg) - Temporary files:
.webmformat (automatically deleted after merging)
The script automatically cleans up temporary files after successful merging. Only final
.mp4 files remain in your backup directory.Scheduling Automated Backups
Using Cron (Linux/macOS/NAS)
Create automated backups using cron jobs:1
Edit Crontab
2
Open your crontab configuration:
3
crontab -e
4
Add Backup Schedule
5
Add one of the following examples based on your needs:
6
Hourly Backup
Daily Backup (Midnight)
Every 4 Hours
Business Hours Only
7
Save and Verify
8
Save the crontab and verify it’s scheduled:
9
# List current cron jobs
crontab -l
# Check cron service status
sudo systemctl status cron
Using Task Scheduler (Windows)
1
Open Task Scheduler
2
Press
Win + R, type taskschd.msc, and press Enter.3
Create New Task
4
5
Set Trigger
6
7
Configure Action
8
C:\Python39\python.exe (adjust path)copy_footage_script_threading.py --api_key YOUR_API_KEY --duration 3600C:\path\to\NAS-Backup-v29
Save and Test
10
API Endpoints Used
The backup script interacts with the following Rhombus API endpoints:Camera Enumeration
Audio Gateway List
Session Token Generation
Video Media URIs
Audio Media URIs
All API calls require authentication using the
x-auth-scheme: api-token header with your API key, or certificate-based mTLS authentication.Performance Optimization
Threading Configuration
The script uses Python’sThreadPoolExecutor with a maximum of 4 concurrent workers. This balances download speed with API rate limits and system resources.
To adjust thread count, modify the script:
- 2-4 workers: Standard NAS or low-end systems
- 4-8 workers: High-performance NAS or servers
- 8-16 workers: Enterprise servers with high bandwidth
Storage Considerations
Calculate Required Space:- 10 cameras × 30 days × 1.5 GB = 450 GB required
- Maintain at least 20% free space on backup device
- Implement retention policies to delete old footage
- Monitor disk usage regularly
- Use compression if long-term archival is needed
Network Optimization
LAN vs WAN:- LAN Mode (default): Faster downloads, uses local network addresses
- WAN Mode (
--usewan): Required for remote backup, slower but accessible from anywhere
- Approximately 2-4 Mbps per concurrent camera download
- 4 workers = 8-16 Mbps recommended bandwidth
Retention and Cleanup
Implement a retention policy to manage storage usage:Troubleshooting
Script Fails with Authentication Error
Script Fails with Authentication Error
Symptoms:
401 UnauthorizederrorsInvalid API keymessages
- Verify API key is correct in Rhombus Console
- Ensure API key has camera access permissions
- Check that
x-auth-schemeheader is set correctly - Regenerate API key if compromised
Downloads Are Very Slow
Downloads Are Very Slow
Symptoms:
- Downloads take longer than expected
- Network timeout errors
- Use LAN mode instead of WAN if backing up locally
- Reduce thread count in
ThreadPoolExecutor - Check network bandwidth and camera connectivity
- Verify storage device write speed
- Consider scheduling backups during off-peak hours
FFmpeg Merge Fails
FFmpeg Merge Fails
Symptoms:
- Temporary
.webmfiles remain - No merged
.mp4output - FFmpeg error messages
- Verify FFmpeg is installed and in PATH
- Check that both video and audio files were downloaded
- Ensure sufficient disk space for temporary files
- Update FFmpeg to latest version
No Cameras Found
No Cameras Found
Symptoms:
- Script reports 0 cameras to backup
- Empty camera list
- Verify cameras are online in Rhombus Console
- Check location UUID filter if specified
- Ensure API key has access to cameras
- Review camera connection status filters in script
Disk Space Issues
Disk Space Issues
Symptoms:
- Script fails with write errors
No space left on devicemessages
- Check available disk space:
df -h - Implement retention policy to delete old footage
- Reduce backup duration or frequency
- Add additional storage capacity
- Use compression for archived footage
Cron Job Not Running
Cron Job Not Running
Symptoms:
- Scheduled backups don’t execute
- No new footage files created
- Check cron service status:
systemctl status cron - Verify crontab syntax:
crontab -l - Check cron logs:
grep CRON /var/log/syslog - Ensure script paths are absolute
- Verify user permissions
Best Practices
Secure API Keys
Never hardcode API keys in scripts. Use environment variables or secure key management systems. Rotate API keys regularly.
Monitor Backups
Set up monitoring and alerting for backup failures. Review logs regularly to ensure backups complete successfully.
Test Restores
Regularly test restoring footage from backups to verify integrity and confirm your recovery process works.
Implement Retention
Define and enforce retention policies to manage storage costs and comply with data protection regulations.
Use Redundancy
Consider multiple backup locations (onsite + offsite) for critical footage. Implement the 3-2-1 backup rule.
Document Procedures
Maintain documentation of your backup configuration, schedules, and recovery procedures for your team.
Security Considerations
API Key Protection
- Store securely: Use environment variables or credential managers
- Restrict access: Limit file permissions on scripts containing keys
- Rotate regularly: Change API keys periodically
- Audit usage: Monitor API key activity in Rhombus Console
Network Security
- Use LAN mode when possible to avoid WAN exposure
- Implement firewall rules to restrict access
- Consider VPN for remote backup scenarios
- Enable mTLS authentication for enhanced security
Storage Security
- Encrypt backup storage devices
- Restrict file system permissions
- Implement access controls on NAS/server
- Regularly audit who has access to backup files
Compliance Considerations
When implementing local backup, consider: Data Retention:- Follow your organization’s data retention policies
- Comply with industry regulations (HIPAA, GDPR, etc.)
- Document retention periods and deletion procedures
- Maintain audit logs of who accesses backup footage
- Implement role-based access controls
- Document authorized personnel
- Encrypt data at rest and in transit
- Implement secure deletion procedures
- Regular security assessments
Advanced Configuration
Custom Output Directory
Modify the script to save files to a specific directory:Email Notifications
Add email alerts for backup completion or failures:Webhook Integration
Trigger webhooks after backup completion:Next Steps
Video Streaming Implementation
Learn how to stream live footage from Rhombus cameras
Webhook Integration
Set up webhooks to receive real-time events
GitHub Repository
Access the complete backup script source code
Developer Community
Ask questions and share your implementation
Additional Resources
- Rhombus API Documentation: Complete API reference for all endpoints
- Python Requests Documentation: docs.python-requests.org
- FFmpeg Documentation: ffmpeg.org/documentation
- Cron Documentation: man7.org/linux/man-pages/man5/crontab.5.html
For questions, issues, or to share your backup implementation, visit the Rhombus Developer Community and post in the Guides & Resources section.