diff --git a/README.md b/README.md index e69de29..5ad57bb 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,54 @@ +# 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 `flask` und optional `python-dotenv` + +```bash +pip install flask python-dotenv +``` + +## Start + +```bash +python3 app.py +``` + +Danach erreichbar unter: + +| URL | Beschreibung | +|---|---| +| `http://:8080/` | HTML-Seite mit Live-Stream | +| `http://:8080/stream` | MJPEG-Stream | +| `http://: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 +``` diff --git a/app.py b/app.py index 6699f23..b3d7983 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -cam.py – Raspberry Pi Camera MJPEG Stream Server +app.py – Raspberry Pi Camera MJPEG Stream Server Startet rpicam-vid als Singleton-Prozess und verteilt Frames per Flask. Erreichbar unter /stream und /stream.mjpg (vehicle-counter kompatibel).