A Flask-based server for managing multi-screen video streaming with SRT protocol and client management.
The server follows a clean, service-oriented architecture:
backend/
├── blueprints/ # Flask route handlers
│ ├── client_management/ # Client registration and management
│ ├── streaming/ # Stream management (multi/split)
│ ├── group_management.py # Group operations
│ ├── video_management.py # Video file operations
│ ├── screen_management.py # Screen configuration
│ ├── docker_management.py # Docker operations
│ └── error_management.py # Error handling and logging
├── services/ # Business logic services
│ ├── docker_service.py # Docker discovery and management
│ ├── ffmpeg_service.py # FFmpeg utilities and commands
│ ├── srt_service.py # SRT connection testing
│ ├── video_validation_service.py # Video file validation
│ └── error_service.py # Error handling services
├── endpoints/ # API endpoint organization
│ ├── blueprints/ # Blueprint imports
│ ├── services/ # Service imports
│ └── uploads/ # Video file storage
├── logs/ # Logging configuration and scripts
│ ├── logging_config.py # Logging setup
│ ├── monitor_logs.py # Log monitoring
│ └── cron_rotate_logs.sh # Log rotation script
├── app_config.py # Configuration management
├── flask_app.py # Main Flask application
├── gunicorn.conf.py # Gunicorn configuration
└── README.md # This file
cd backend
python3 flask_app.pycurl -X POST http://localhost:5000/api/streaming/start_split_screen_srt \
-H "Content-Type: application/json" \
-d '{
"group_id": "your-group-id",
"video_file": "video.mp4",
"orientation": "horizontal"
}'curl -X POST http://localhost:5000/api/streaming/start_multi_video_srt \
-H "Content-Type: application/json" \
-d '{
"group_id": "your-group-id",
"video_files": ["video1.mp4", "video2.mp4"],
"layout": "grid"
}'curl -X POST http://localhost:5000/api/streaming/stop_group_stream \
-H "Content-Type: application/json" \
-d '{"group_id": "your-group-id"}'Edit app_config.json to customize:
- Server settings (host, port, debug)
- File settings (upload folder, max file size, allowed extensions)
- Streaming settings (default framerate, bitrate, SRT parameters)
POST /api/clients/register- Register a new clientGET /api/clients/status- Get client statusGET /api/clients/all- Get all registered clients
POST /api/streaming/start_split_screen_srt- Start split-screen streamingPOST /api/streaming/start_multi_video_srt- Start multi-video streamingPOST /api/streaming/stop_group_stream- Stop streaming for a groupGET /api/streaming/all_streaming_statuses- Get all streaming statuses
POST /api/groups/create- Create a new groupGET /api/groups/all- Get all groupsDELETE /api/groups/<group_id>- Delete a group
POST /api/videos/upload- Upload video fileGET /api/videos/all- Get all available videosDELETE /api/videos/<filename>- Delete a video
GET /api/docker/containers- Get Docker container informationGET /api/docker/groups- Discover groups from Docker
GET /- API information and endpointsGET /health- Health check
- Split-Screen Streaming - Single video split into multiple regions
- Multi-Video Streaming - Multiple videos combined into one stream
- SRT Protocol - Low-latency video streaming
- Client Management - Client registration and status tracking
- Docker Integration - Automatic group discovery
- FFmpeg Integration - Advanced video processing
- Comprehensive Logging - Centralized logging system
- Error Management - Robust error handling and reporting
- Single Responsibility - Each class has one clear purpose
- Clean Interfaces - Simple, consistent method signatures
- Error Handling - Consistent error responses and logging
- Type Hints - Better code understanding
- Modular Design - Blueprint-based organization
All logging is centralized in the logs/ directory:
- logging_config.py - Main logging configuration
- monitor_logs.py - Log monitoring and rotation
- cron_rotate_logs.sh - Automated log rotation script
- Python 3.7+
- FFmpeg
- Docker (for group discovery)
- Flask
- Flask-CORS
- psutil
The server maintains backward compatibility with existing routes while providing new, cleaner API endpoints. All new development should use the /api/ prefixed routes.