A proxy microservice within the crowsnest ecosystem which acts as a gateway between the local rtsp server (part of the core crowsnest setup) and external consumers of the video and audio streams.
The proxy is built using WebRTC to minimize latency and enable live streams from remote setups without static addresses. Signalling (some more details here) utilizes MQTTv5 with response topics and correlation data using the ordinary crowsnest base setup for MQTT transport.
The proxy:
- Connects to a
MEDIA_SOURCE
, i.e. the rtsp server address. - Listens on a
MQTT_BASE_TOPIC
(including all subtopics, i.e.MQTT_BASETOPIC/#
for WebRTC "offers" - Uses the remainder of the topic path, i.e. everything caught by the
#
, as thertsp path
- Tries to connect to
MEDIA_SOURCE
usingrtsp path
and fetch the livestream - Reply with a WebRTC "answer"
version: '3'
services:
webrtc-proxy:
image: ghcr.io/mo-rise/crowsnest-proxy-webrtc:latest
restart: unless-stopped
network_mode: "host"
environment:
- MQTT_BROKER_HOST=localhost
- MQTT_BROKER_PORT=1883
- MQTT_BASE_TOPIC=CROWSNEST/<platform>/WEBRTC
- MEDIA_SOURCE=rtsp://localhost:8554
To setup the development environment:
python3 -m venv venv
source ven/bin/activate
Install everything thats needed for development:
pip install -r requirements_dev.txt
To run the linters:
black main.py tests
pylint main.py
To run the tests:
no automatic tests yet...
For local, manual testing, see examples/
Apache 2.0, see LICENSE