How to publish metadata and frame over MQTT#
Pre-requisites:
MQTT_HOST
andMQTT_PORT
environment variable must be set for DL Streamer Pipeline Server prior to sending this curl request. You can do this by adding these variables to.env
file present in the same folder asdocker-compose.yml
.MQTT_HOST=<MQTT_BROKER_IP> MQTT_PORT=<MQTT_BROKER_PORT>
Alternatively, you can add them to the
environments
for DL Streamer Pipeline Server section indocker-compose.yml
.dlstreamer-pipeline-server: environment: - MQTT_HOST=<MQTT_BROKER_IP> - MQTT_PORT=<MQTT_BROKER_PORT>
The below CURL command publishes metadata to a MQTT broker and sends frames over RTSP for streaming.
Assuming broker is running in the same host over port 1883
, replace the <SYSTEM_IP_ADDRESS>
field with your system IP address.
RTSP Stream will be accessible at rtsp://<SYSTEM_IP_ADDRESS>:8554/pallet_defect_detection
.
curl localhost:8080/pipelines/user_defined_pipelines/pallet_defect_detection -X POST -H 'Content-Type: application/json' -d '{
"source": {
"uri": "file:///home/pipeline-server/resources/videos/warehouse.avi",
"type": "uri"
},
"destination": {
"metadata": {
"type": "mqtt",
"publish_frame":true,
"topic": "pallet_defect_detection"
},
"frame": {
"type": "rtsp",
"path": "pallet_defect_detection"
}
},
"parameters": {
"detection-properties": {
"model": "/home/pipeline-server/resources/models/geti/pallet_defect_detection/deployment/Detection/model/model.xml",
"device": "CPU"
}
}
}'
Output can be viewed on MQTT subscriber as shown below.
docker run -it --entrypoint mosquitto_sub eclipse-mosquitto:latest --topic pallet_defect_detection -p 1883 -h <SYSTEM_IP_ADDRESS>
For more details on MQTT you can refer this document