Advanced security camera management platform with face recognition, PTZ control, and real-time video processing.
A Python-based desktop application for professional surveillance operations, combining OpenCV computer vision with a modern PyQt5 interface.
RAVN provides enterprise-grade security camera management with:
- Real-time video capture from RTSP sources (IP cameras, NVRs)
- Intelligent face recognition for person identification and alerts
- PTZ control (Pan-Tilt-Zoom) for dynamic camera positioning
- Video recording with configurable codec and quality
- Configuration management for multi-site deployments
- Professional GUI with status monitoring and settings
Ideal for security operations centers, retail surveillance, and facility monitoring.
| Component | Technology |
|---|---|
| Language | Python 3.8+ |
| GUI Framework | PyQt5 |
| Computer Vision | OpenCV |
| Camera Protocol | RTSP, ONVIF |
| Face Recognition | Deep learning models |
| Video Codec | H.264, MJPEG |
| Logging | Python logging module |
- Python 3.8+
- pip package manager
- RTSP-compatible IP camera or NVR
- 1GB RAM minimum (4GB+ recommended for multiple streams)
# 1. Clone the repository
git clone https://github.com/bragestoefringshaug/RAVN
cd RAVN
# 2. Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
venv\Scripts\activate # Windows
# 3. Install dependencies
pip install -r requirements.txt
# 4. Configure environment
cp .env.example .envEdit .env with your environment:
RTSP_URL=rtsp://username:password@camera.local:554/stream
FRAME_WIDTH=1920
FRAME_HEIGHT=1080
ENABLE_RECORDING=true
RECORDING_PATH=./recordingspython src/main.pyThe GUI will launch with an automatic first-time setup wizard.
- Connect to multiple RTSP sources
- Real-time frame capture and display
- Configurable resolution and bitrate
- Connection health monitoring
- Detect faces in video stream
- Identify known persons from database
- Alert on suspicious activity
- Export recognition logs
- Remote pan, tilt, zoom operations
- Preset position save/load
- Smooth motion control
- ONVIF protocol support
- Continuous or event-triggered recording
- Configurable quality and codec
- Timestamp embedding
- Automatic cleanup policies
- Per-site camera profiles
- User preferences persistence
- Security and API settings
- Export/import configurations
RAVN/
βββ src/
β βββ main.py # Application entry point
β βββ Camera.py # Camera capture & recording
β βββ face_recognition/ # Face detection & identification
β β βββ face_detector.py
β β βββ face_recognizer.py
β β βββ models/
β βββ gui/ # PyQt5 user interface
β β βββ main_window.py
β β βββ settings_dialog.py
β β βββ ptz_window.py
β β βββ widgets/
β βββ ptz/ # Pan-Tilt-Zoom control
β β βββ ptz_controller.py
β β βββ presets.py
β βββ utils/ # Utilities and helpers
β βββ icons.py
β βββ logging_config.py
β βββ validators.py
βββ config/
β βββ config_manager.py # Configuration persistence
β βββ settings.py # Runtime settings
β βββ presets.json # PTZ presets
βββ data/ # Application data (logs, cache)
βββ resources/ # Icons, assets
βββ requirements.txt # Python dependencies
βββ .env # Environment variables
βββ README.md
RAVN follows a modular architecture:
- Camera Module (
Camera.py) β Handles RTSP connections and video I/O - Face Recognition β Pluggable detection/recognition system
- PTZ Controller β ONVIF client for camera control
- GUI Layer β PyQt5 interface with threaded rendering
- Config Manager β Persistent settings and state
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Run with debug logging
LOGLEVEL=DEBUG python src/main.pyfrom src.Camera import CameraCapture
with CameraCapture(rtsp_url="rtsp://...") as camera:
success, frame = camera.read()
if success:
process(frame)from src.ptz import PTZController
ptz = PTZController(onvif_url="http://camera.local:8080/onvif/device_service")
ptz.pan(0.5) # Pan right
ptz.zoom(1.2) # Zoom inExample: Slack alerts on face detection
# In face_recognizer.py
if confidence > ALERT_THRESHOLD:
send_slack_alert({
'person': name,
'confidence': confidence,
'timestamp': datetime.now(),
'snapshot': frame
})| Method | Parameters | Returns | Description |
|---|---|---|---|
start() |
β | bool |
Connect and initialize camera |
stop() |
β | bool |
Disconnect and cleanup |
read() |
β | (bool, ndarray) |
Get next frame |
record() |
output_path |
bool |
Start recording session |
stop_record() |
β | bool |
End recording |
| Method | Parameters | Returns | Description |
|---|---|---|---|
pan(speed) |
-1.0 to 1.0 |
bool |
Horizontal movement |
tilt(speed) |
-1.0 to 1.0 |
bool |
Vertical movement |
zoom(factor) |
float |
bool |
Zoom in/out |
goto_preset(id) |
string |
bool |
Move to saved position |
save_preset(name) |
string |
bool |
Save current position |
from config.settings import Settings
# Get settings
rtsp_url = Settings.get_rtsp_url()
recording_path = Settings.get_recording_path()
# Set settings
Settings.set_enable_recording(True)
Settings.save()- RTSP Authentication: Credentials stored in encrypted
.env - ONVIF Security: TLS support for camera control
- Recording Privacy: Optional redaction zones
- Access Control: User roles and permissions (configurable)
- Audit Logging: All operations logged with timestamps
RTSP_URL=rtsp://admin:password@192.168.1.100:554/stream
FRAME_WIDTH=1920
FRAME_HEIGHT=1080
ENABLE_FACE_RECOGNITION=true
ENABLE_RECORDING=falseCreate separate .env files per site:
configs/
βββ warehouse.env
βββ reception.env
βββ entrance.env
Launch with: python src/main.py --config configs/warehouse.env
[ERROR] Camera connection failed: Connection refused
- Verify camera IP and credentials
- Ensure RTSP port (typically 554) is open
- Check firewall rules
- Verify face detection model is downloaded
- Ensure face database is properly configured
- Check frame resolution is at least 480p
- Reduce frame resolution
- Disable face recognition if not needed
- Lower recording bitrate
- Use hardware acceleration (if supported)
- Verify ONVIF endpoint URL
- Check camera firmware supports PTZ
- Ensure network connectivity to camera
| Package | Version | Purpose |
|---|---|---|
| opencv-python | >=4.8.0 | Video capture & processing |
| PyQt5 | >=5.15.0 | GUI framework |
| numpy | >=1.24.0 | Array operations |
| onvif-zeep | >=0.2.12 | ONVIF camera control |
| requests | >=2.31.0 | HTTP client |
| python-dotenv | >=1.0.0 | Environment management |
- Multi-camera dashboard with synchronized view
- Cloud integration (AWS, Azure) for remote monitoring
- Mobile app for smartphone monitoring
- Analytics β traffic counting, behavior analysis
- Event timeline β searchable incident log
- Webhook integrations β Slack, Teams, webhooks
- Database backend β PostgreSQL for scalability
MIT License β open for use and extension.
Brage StΓΈfringshaug
Specialized in Python backend systems, computer vision applications, and security infrastructure.
π§ bragestofringshaug@gmail.com
π https://github.com/bragestoefringshaug
Issues and pull requests welcome! Please include:
- Description of issue/feature
- Environment details (Python version, OS, camera model)
- Logs from
data/logs/directory
- π Full documentation: GitHub Wiki
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions