Introduction
Introduction Statistics Contact Development Disclaimer Help
webcam-stream.sh: add MQTT streaming of webcam - brcon2024-hackathons - Bitreic…
git clone git://bitreich.org/brcon2024-hackathons git://enlrupgkhuxnvlhsf6lc3fz…
Log
Files
Refs
Tags
Submodules
---
commit 335b1e03150eb03337a5268bd899689277c51923
parent 4cdf353a068334e1e2de224e05d022dcd303a26d
Author: Anders Damsgaard <[email protected]>
Date: Fri, 9 Aug 2024 10:56:54 +0200
webcam-stream.sh: add MQTT streaming of webcam
Signed-off-by: Christoph Lohmann <[email protected]>
Diffstat:
A mqtt/webcam-stream.sh | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/mqtt/webcam-stream.sh b/mqtt/webcam-stream.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# stream your face to a MQTT topic
+# requirements:
+# ffmpeg
+# imcat: https://github.com/stolk/imcat
+# mosquitto_pub: https://github.com/eclipse/mosquitto
+uri="${MQTT_URI:-mqtt://bitreich:[email protected]:65431/}"
+topic="${MQTT_TOPIC:-faces/$USER}"
+sleep="${CAM_INTERVAL:-10}"
+device="${1:-video0}"
+f="$(mktemp).jpg"
+while :
+do
+ ffmpeg -y -f v4l2 -video_size 1280x720 -i "/dev/${device}" \
+ -qscale:v 2 -vframes 2 -r 0.2 -update 1 "$f" \
+ -loglevel 0 </dev/null
+ if ! msg="$(echo; imcat "$f")"
+ then
+ exit 2
+ fi
+ mosquitto_pub -L "${uri}${topic}" -m "$msg"
+ sleep "$sleep"
+done
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.