1. 安装库
先按照这个文件\opt\nvidia\deepstream\deepstream-6.4\sources\libs\mqtt_protocol_adaptor\README安装一些依赖库。
整成一条命令就是:
sudo apt-get install libglib2.0 libglib2.0-dev libcjson-dev libssl-dev && \
wget https://mosquitto.org/files/source/mosquitto-2.0.15.tar.gz && tar -xvf mosquitto-2.0.15.tar.gz && cd mosquitto-2.0.15 && make && make install && \
cp /usr/local/lib/libmosquitto* /opt/nvidia/deepstream/deepstream/lib/ && ldconfig && adduser --system mosquitto && mosquitto -v
// mosquitto -v 就是启动程序的命令,-v可以打印啰嗦日志。
2. test_mqtt_proto_async 测试
到/opt/nvidia/deepstream/deepstream/sources/libs/mqtt_protocol_adaptor目录下,执行make -f Makefile.test进行编译,执行./test_mqtt_proto_async进行测试。使用的是默认测试。
3. deepstream-test5测试
到/opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-test5/configs下,
将test5_config_file_src_infer.yml拷贝一份成test5_config_file_src_infer_mqtt.yml,主要是蛇者如下红色部分。
sink1:
enable: 1
#Type - 1=FakeSink 2=EglSink 3=File 4=UDPSink 5=nvdrmvideosink 6=MsgConvBroker
type: 6
msg-conv-config: dstest5_msgconv_sample_config.yml
#(0): PAYLOAD_DEEPSTREAM - Deepstream schema payload
#(1): PAYLOAD_DEEPSTREAM_MINIMAL - Deepstream schema payload minimal
#(256): PAYLOAD_RESERVED - Reserved type
#(257): PAYLOAD_CUSTOM - Custom schema payload
msg-conv-payload-type: 1
#msg-conv-msg2p-new-api=0 #默认是0.
msg-broker-proto-lib: /opt/nvidia/deepstream/deepstream/lib/libnvds_mqtt_proto.so
topic: topic1
msg-broker-conn-str: localhost;1883
#Optional:
#msg-broker-config: ../../../../libs/azure_protocol_adaptor/module_client/cfg_azure.txt
msg-broker-config: /opt/nvidia/deepstream/deepstream/sources/libs/mqtt_protocol_adaptor/cfg_mqtt.txt
设置完后,到上一层目录,执行
./deepstream-test5-app -c configs/test5_config_file_src_infer_mqtt.yml