8526a1bc39aba7067ad47cfe618d4478ad4cc9ae
raspi-cam
MJPEG-Stream-Server für die Raspberry-Pi-Kamera. Startet rpicam-vid einmalig als Singleton-Prozess und verteilt die Frames per Flask an beliebig viele Viewer. Bei einem Absturz von rpicam-vid erfolgt ein automatischer Neustart.
Voraussetzungen
- Raspberry Pi mit angeschlossener Kamera
rpicam-vid(rpicam-apps)- Python 3 mit
flaskund optionalpython-dotenv
pip install flask python-dotenv
Start
python3 app.py
Danach erreichbar unter:
| URL | Beschreibung |
|---|---|
http://<host>:8080/ |
HTML-Seite mit Live-Stream |
http://<host>:8080/stream |
MJPEG-Stream |
http://<host>:8080/stream.mjpg |
MJPEG-Stream (vehicle-counter kompatibel) |
Konfiguration
Die Konfiguration erfolgt über Umgebungsvariablen oder eine .env-Datei im Projektverzeichnis.
| Variable | Beschreibung | Default |
|---|---|---|
APP_HOST |
Bind-Adresse | 0.0.0.0 |
APP_PORT |
HTTP-Port | 8080 |
CAM_MODE |
Sensor-Modus | 1640:1232 |
CAM_WIDTH |
Ausgabebreite | 640 |
CAM_HEIGHT |
Ausgabehöhe | 480 |
CAM_FRAMERATE |
Ziel-FPS | 20 |
CAM_QUALITY |
JPEG-Qualität (1–100) | 30 |
CAM_ROTATION |
Rotation (0/90/180/270) | leer |
Beispiel .env:
CAM_MODE=1640:1232
CAM_WIDTH=820
CAM_HEIGHT=616
CAM_FRAMERATE=20
CAM_QUALITY=50
CAM_ROTATION=
APP_PORT=8080
Languages
Python
100%