Add /snapshot.jpg endpoint
This commit is contained in:
1 parent
7e1944ed04
commit
15f62b6d81
2 files changed
+14
No files matched your search
@@ -3,6 +3,7 @@
|
||||
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).
|
||||
Einzelbild des aktuellen Frames unter /snapshot.jpg.
|
||||
|
||||
.env-Variablen:
|
||||
APP_HOST Bind-Adresse (default: 0.0.0.0)
|
||||
@@ -218,6 +219,16 @@ def stream():
|
||||
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 ─────────────────────────────────────────────────────────────────────
|
||||
def _shutdown(sig, frame):
|
||||
print("[cam] Beende …", flush=True)
|
||||
|
||||
Reference in new issue
Block a user