A comprehensive platform providing RTSP video streaming and automated billing services with API management.
- Real-time Video Streaming using MediaMTX
- Multiple Input Sources (cameras, files, live streams)
- API-controlled Stream Management
- Authentication & Access Control
- Recording Capabilities
- Built-in Metrics & Monitoring
- AI-Powered Incident Detection using Gemini AI
- Private Video Links instead of email attachments
- Secure Video Hosting on sparse-ai.com
- Automatic Link Expiration for enhanced security
- Frame Buffer Management for incident context
- Multi-language Support (French alerts)
- Automatic Cleanup of old incident files (30-day retention)
- Offline Mode with local fallback storage
- Incident Deduplication to prevent spam (60s cooldown)
- Automated Invoice Generation (weekly/monthly/quarterly)
- Multiple Payment Methods (credit cards, bank transfers, direct debit)
- Real-time Usage Tracking
- Cost Monitoring & Alerts
- Email Invoice Delivery
- Stripe & Qonto Integration
- API Key Authentication
- Usage-based Billing
- Rate Limiting & Monitoring
- Comprehensive Logging
- Python 3.8+
- MediaMTX binary (for RTSP functionality)
- Database (SQLite/PostgreSQL/MySQL)
-
Clone and Setup:
git clone <repository-url> cd vigint python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Configure:
# Copy configuration templates cp config.ini.example config.ini cp server_config.ini.example server_config.ini # Edit configuration files with your settings nano config.ini
-
Initialize Database:
python3 start_vigint.py --init-db
-
Download MediaMTX (for RTSP functionality):
# Download from https://github.com/bluenviron/mediamtx/releases wget https://github.com/bluenviron/mediamtx/releases/latest/download/mediamtx_linux_amd64.tar.gz tar -xzf mediamtx_linux_amd64.tar.gz chmod +x mediamtx
# Start full application (API + RTSP)
./start.sh
# Start only API server
./start.sh api
# Start only RTSP server
./start.sh rtsp
# Or use Python directly
python3 start_vigint.py --mode full- RTSP Server Guide - Complete RTSP streaming documentation
- Billing System Guide - Billing and payment processing documentation
- Video Link Service Setup - Private video links for security alerts
[Database]
database_url = sqlite:///vigint.db
[API]
secret_key = your-secret-key
host = 0.0.0.0
port = 5000
[Email]
smtp_server = smtp.gmail.com
smtp_port = 587
sender_email = [email protected]
sender_password = your-app-password
[SparseAI]
# Video hosting for security alerts
api_key = your-sparse-ai-api-key
base_url = https://sparse-ai.com
default_expiration_hours = 48
[Stripe]
api_key = sk_test_your_stripe_keyexport VIGINT_CONFIG_PATH=/path/to/config.ini
export VIGINT_SERVER_CONFIG_PATH=/path/to/server_config.ini# Get API key (create client first)
curl -X POST http://localhost:5000/api/clients \
-H "Content-Type: application/json" \
-d '{"name": "Test Client", "email": "[email protected]"}'# List streams
curl -H "X-API-Key: your-api-key" \
http://localhost:5000/api/rtsp/paths/list
# Stream URL format
rtsp://localhost:8554/stream_name# Send security alert with video frames
curl -X POST http://localhost:5000/api/video/alert \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"analysis": "Security incident detected",
"risk_level": "HIGH",
"incident_type": "shoplifting",
"frame_count": 150
}'New Feature: Videos are now uploaded to sparse-ai.com and private links are sent via email instead of large attachments.
# Python usage
from alerts import send_security_alert_with_video
result = send_security_alert_with_video(
message="Security incident detected",
frames=frame_buffer, # Your video frames
incident_data={
'incident_type': 'shoplifting',
'risk_level': 'HIGH',
'analysis': 'Customer concealing merchandise'
}
)
# Email will contain private link like:
# https://sparse-ai.com/video/abc123?token=xyz789# Get usage statistics
curl -H "X-API-Key: your-api-key" \
http://localhost:5000/api/usage# Weekly billing (Mondays at 9 AM)
0 9 * * 1 /path/to/vigint/run_weekly_billing.py
# Daily cost monitoring
0 8 * * * /path/to/vigint/cost_monitor.py# Generate invoices manually
python3 generate_weekly_invoices.py
# Run cost monitoring
python3 cost_monitor.pyvigint/
βββ vigint/ # Core package
β βββ models.py # Database models
β βββ billing_manager.py # Billing system
β βββ invoice_generator.py # Invoice generation
βββ config.py # Configuration management
βββ auth.py # Authentication system
βββ api_proxy.py # API proxy and routing
βββ rtsp_server.py # RTSP server management
βββ start_vigint.py # Main application entry
βββ start.sh # Startup script
βββ mediamtx_simple.yml # MediaMTX configuration
βββ generate_weekly_invoices.py # Invoice generation
βββ cost_monitor.py # Cost monitoring
βββ requirements.txt # Dependencies
# API health
curl http://localhost:5000/api/health
# RTSP server status
./start_rtsp_server status
# MediaMTX API
curl http://localhost:9997/v1/config/global/get- Application:
vigint.log - MediaMTX:
mediamtx.log - Billing:
/var/log/vigint/billing.log
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=vigint# Format code
black .
# Lint code
flake8 .
# Type checking
mypy vigint/# Build image
docker build -t vigint .
# Run container
docker run -p 5000:5000 -p 8554:8554 vigint# MediaMTX metrics
curl http://localhost:9998/metrics
# Application metrics
curl http://localhost:5000/metricsThe system automatically monitors:
- Daily cost thresholds
- Per-client usage limits
- Unusual usage patterns
- API Key Authentication with secure hashing
- Payment Tokenization via Stripe
- Configuration Security with example templates
- Audit Logging for all operations
- Rate Limiting and usage monitoring