How to configure different Kafka topics for different sources on deepstream

If a video source is configured in [source0], and then a Kafka topic is configured in [sink], the yolov5 recognition result can be sent to the Kafka server normally. However, when I configure another [source1], and then add source id = 0 and source id = 1 in [sink1] and [sink2], the following error will appear.


What is the solution, or how can I configure different topics for different video sources

Is this question shares the same program/setup with topic Why can these sources be displayed in one window after configuring multiple sources on deepstream, but yolov5 can only identify one of them?

Yes, when I change the original configuration file to this, the above error will be displayed. If I delete [sink2], it will work normally
[source0]
enable=1
type=3
uri=rtsp://admin:123654zjk@10.129.53.45:554/h264/ch1/main/av_stream
num-sources=2
gpu-id=1
cudadec-memtype=0
drop-frame-interval=0

[source1]
enable=1
type=3
uri=rtsp://admin:123654zjk@10.129.53.45:554/h264/ch1/main/av_stream
num-sources=2
gpu-id=1
cudadec-memtype=0
drop-frame-interval=0
[sink0]
enable=1
type=2
sync=0
gpu-id=1
nvbuf-memory-type=0

[sink1]
enable=1
type=6
msg-conv-config=dstest5_msgconv_sample_config.txt
msg-conv-payload-type=1
msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream-6.1/lib/libnvds_kafka_proto.so
msg-broker-conn-str=10.129.53.100;9092;video
topic=video2
iframeinterval=10
source-id=0
[sink2]
enable=1
type=6
msg-conv-config=dstest5_msgconv_sample_config.txt
msg-conv-payload-type=1
msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream-6.1/lib/libnvds_kafka_proto.so
msg-broker-conn-str=10.129.53.100;9092;video
topic=video3
iframeinterval=10
source-id=1
[sink3]
enable=0
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=4000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0

set below properties in case of RTSPStreaming

rtsp-port=8554
udp-port=5400

yes

Yes, when I change the original configuration file to this, the above error will be displayed. If I delete [sink2], it will work normally
[source0]
enable=1
type=3
uri=rtsp://admin:123654zjk@10.129.53.45:554/h264/ch1/main/av_stream
num-sources=2
gpu-id=1
cudadec-memtype=0
drop-frame-interval=0

[source1]
enable=1
type=3
uri=rtsp://admin:123654zjk@10.129.53.45:554/h264/ch1/main/av_stream
num-sources=2
gpu-id=1
cudadec-memtype=0
drop-frame-interval=0
[sink0]
enable=1
type=2
sync=0
gpu-id=1
nvbuf-memory-type=0

[sink1]
enable=1
type=6
msg-conv-config=dstest5_msgconv_sample_config.txt
msg-conv-payload-type=1
msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream-6.1/lib/libnvds_kafka_proto.so
msg-broker-conn-str=10.129.53.100;9092;video
topic=video2
iframeinterval=10
source-id=0
[sink2]
enable=1
type=6
msg-conv-config=dstest5_msgconv_sample_config.txt
msg-conv-payload-type=1
msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream-6.1/lib/libnvds_kafka_proto.so
msg-broker-conn-str=10.129.53.100;9092;video
topic=video3
iframeinterval=10
source-id=1
[sink3]
enable=0
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=4000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0

set below properties in case of RTSPStreaming

rtsp-port=8554
udp-port=5400

Try this config, it works on my side.

[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.txt
#(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=0
#(0): Create payload using NvdsEventMsgMeta
#(1): New Api to create payload using NvDsFrameMeta
msg-conv-msg2p-new-api=0
#Frame interval at which payload is generated
msg-conv-frame-interval=30
msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream/lib/libnvds_kafka_proto.so
#Provide your msg-broker-conn-str here
msg-broker-conn-str=IP;9092;dstest
topic=dstest
disable-msgconv = 1
#source-id=0
#Optional:
#msg-broker-config=/opt/nvidia/deepstream/deepstream/sources/libs/kafka_protocol_adaptor/cfg_kafka.txt
#new-api=0
#(0) Use message adapter library api’s
#(1) Use new msgbroker library api’s

[sink3]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=UDPSink 5=nvdrmvideosink 6=MsgConvBroker
type=6
msg-conv-config=dstest5_msgconv_sample_config.txt
#(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=0
#(0): Create payload using NvdsEventMsgMeta
#(1): New Api to create payload using NvDsFrameMeta
msg-conv-msg2p-new-api=0
#Frame interval at which payload is generated
msg-conv-frame-interval=30
msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream/lib/libnvds_kafka_proto.so
#Provide your msg-broker-conn-str here
msg-broker-conn-str=IP;9092;dstest2
topic=dstest2
disable-msgconv = 1
#source-id=1
#Optional:
#msg-broker-config=/opt/nvidia/deepstream/deepstream/sources/libs/kafka_protocol_adaptor/cfg_kafka.txt
#new-api=0
#(0) Use message adapter library api’s
#(1) Use new msgbroker library api’s

[message-converter]
enable=1
msg-conv-config=dstest5_msgconv_sample_config.txt
#(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=0
# Name of library having custom implementation.
msg-conv-msg2p-lib=/opt/nvidia/deepstream/deepstream/lib/libnvds_msgconv.so
# Id of component in case only selected message to parse.
#msg-conv-comp-id=

Oh, forgot to enable source-id, need to check.

I modified it according to your configuration file, but this error will still pop up. I can’t find a solution. As long as it involves multiple topics, this error will pop up

I modified it according to your configuration file, but this error will still pop up. I can’t find a solution. As long as it involves multiple topics, this error will pop up

Hello! Apologies for the confusion, but DeepStream does not currently support different topics for multiple sources. Different topics for the same stream (with stream-id=0) can be specified with multiple sinks, each pointing to the same msgbroker but with differentn topic names.