A lightweight RTSP stream relay server built with Python and Flask. This application allows you to view RTSP camera streams in a web browser by converting them to MJPEG format.
- Convert RTSP streams to MJPEG for browser compatibility
- Environment variable based configuration
- Docker support
- Full-screen video display
- Multiple stream support
- Low latency streaming
- Python 3.11 or higher
- FFmpeg
- Docker (optional)
-
Clone the repository:
git clone https://github.com/yourusername/RTSPy.git cd RTSPy -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Clone the repository:
git clone https://github.com/yourusername/RTSPy.git cd RTSPy -
Build and run with Docker Compose:
docker-compose up -d
The application uses environment variables to configure RTSP streams. Each stream should be configured using the format:
STREAM_<NAME>=rtsp://username:password@camera-ip:port/stream-path
For example:
STREAM_FRONT_DOOR=rtsp://admin:[email protected]:554/stream1
STREAM_GARAGE=rtsp://admin:[email protected]:554/stream1You can configure streams in your docker-compose.yml:
services:
rtsp-relay:
environment:
- STREAM_FRONT_DOOR=rtsp://admin:[email protected]:554/stream1
- STREAM_GARAGE=rtsp://admin:[email protected]:554/stream1-
Set environment variables for your streams:
export STREAM_FRONT_DOOR=rtsp://admin:[email protected]:554/stream1
-
Start the server:
python app.py
-
Access streams in your browser:
- Front door:
http://localhost:8700/front_door - GARAGE:
http://localhost:8700/GARAGE
- Front door:
The server will be available at http://localhost:8700 after starting with Docker Compose.
- Store sensitive credentials in environment variables or Docker secrets
- The application runs on port 8700 by default - ensure this port is properly secured
- Consider using Docker secrets for production deployments
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.