Add /snapshot.jpg endpoint
This commit is contained in:
1 parent
7e1944ed04
commit
15f62b6d81
2 files changed
+14
No files matched your search
@@ -30,6 +30,9 @@ Danach erreichbar unter:
|
|||||||
| `http://<host>:8080/` | HTML-Seite mit Live-Stream |
|
| `http://<host>:8080/` | HTML-Seite mit Live-Stream |
|
||||||
| `http://<host>:8080/stream` | MJPEG-Stream |
|
| `http://<host>:8080/stream` | MJPEG-Stream |
|
||||||
| `http://<host>:8080/stream.mjpg` | MJPEG-Stream (vehicle-counter kompatibel) |
|
| `http://<host>:8080/stream.mjpg` | MJPEG-Stream (vehicle-counter kompatibel) |
|
||||||
|
| `http://<host>:8080/snapshot.jpg` | Einzelbild (aktueller Frame als JPEG) |
|
||||||
|
|
||||||
|
Beispiel: `curl -o foto.jpg http://<host>:8080/snapshot.jpg`
|
||||||
|
|
||||||
## Autostart mit systemd
|
## Autostart mit systemd
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
app.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.
|
Startet rpicam-vid als Singleton-Prozess und verteilt Frames per Flask.
|
||||||
Erreichbar unter /stream und /stream.mjpg (vehicle-counter kompatibel).
|
Erreichbar unter /stream und /stream.mjpg (vehicle-counter kompatibel).
|
||||||
|
Einzelbild des aktuellen Frames unter /snapshot.jpg.
|
||||||
|
|
||||||
.env-Variablen:
|
.env-Variablen:
|
||||||
APP_HOST Bind-Adresse (default: 0.0.0.0)
|
APP_HOST Bind-Adresse (default: 0.0.0.0)
|
||||||
@@ -218,6 +219,16 @@ def stream():
|
|||||||
return _mjpeg_response()
|
return _mjpeg_response()
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/snapshot.jpg")
|
||||||
|
def snapshot():
|
||||||
|
with grabber.lock:
|
||||||
|
frame = grabber.frame
|
||||||
|
if frame is None:
|
||||||
|
return Response("Noch kein Frame verfügbar", status=503, mimetype="text/plain")
|
||||||
|
return Response(frame, mimetype="image/jpeg",
|
||||||
|
headers={"Cache-Control": "no-store"})
|
||||||
|
|
||||||
|
|
||||||
# ── Start ─────────────────────────────────────────────────────────────────────
|
# ── Start ─────────────────────────────────────────────────────────────────────
|
||||||
def _shutdown(sig, frame):
|
def _shutdown(sig, frame):
|
||||||
print("[cam] Beende …", flush=True)
|
print("[cam] Beende …", flush=True)
|
||||||
|
|||||||
Reference in new issue
Block a user