Camera Streaming
Practical WebRTC streaming and inference pipelines for Kataglyphis.
1) Start the signalling server
cd /opt/gst-plugins-rs/net/webrtc/signalling
WEBRTCSINK_SIGNALLING_SERVER_LOG=debug cargo run --bin gst-webrtc-signalling-server -- --port 8444 --host 127.0.0.1
2) Export plugin path (if required)
export GST_PLUGIN_PATH=/home/user/gst-plugins-rs/target/release:$GST_PLUGIN_PATH
3) Start a stream source
USB webcam
gst-launch-1.0 -e webrtcsink signaller::uri="ws://127.0.0.1:8444" name=ws \
meta="meta,name=kataglyphis-webfrontend-stream" \
v4l2src device=/dev/video0 ! image/jpeg,width=640,height=360,framerate=30/1 ! \
jpegdec ! videoconvert ! ws.
Pylon camera
gst-launch-1.0 -e webrtcsink signaller::uri="ws://127.0.0.1:8444" name=ws \
meta="meta,name=kataglyphis-webfrontend-stream" \
pylonsrc ! videoconvert ! ws.
Raspberry Pi / Orange Pi (example)
GST_DEBUG=3 gst-launch-1.0 \
libcamerasrc ! video/x-raw,format=RGB,width=640,height=360,framerate=30/1 ! \
videoconvert ! video/x-raw,format=I420 ! queue ! \
vp8enc deadline=1 threads=2 ! queue ! \
webrtcsink signaller::uri="ws://0.0.0.0:8443" name=ws meta="meta,name=gst-stream"
4) Run the web frontend
flutter run -d web-server --profile --web-port 8080 --web-hostname 0.0.0.0
5) Python inference demos
Install dependencies:
sudo apt install -y libgirepository1.0-dev gir1.2-glib-2.0 \
build-essential pkg-config python3-dev libgirepository-2.0-dev \
gobject-introspection libcairo2-dev python3-gi python3-gi-cairo gir1.2-gtk-4.0
Optional virtual environment with system packages:
python3 -m venv --system-site-packages .venv
Run demo_ai.py:
uv venv
uv pip install loguru pygobject numpy opencv-python
GST_DEBUG=3 python3 demo_ai.py
Run demo_yolov5.py:
uv venv
uv pip install loguru pygobject numpy opencv-python
uv pip install torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cu121
uv pip install seaborn ultralytics
GST_DEBUG=3 python3 demo_yolov5.py
Troubleshooting
- Use
GST_DEBUG=2orGST_DEBUG=3to inspect pipeline performance and caps negotiation. - Validate camera device permissions (
/dev/video*) when streams fail to start. - Ensure host/port pairs in
signaller::urimatch your signalling server.