Deepstream test5 smart recording triggered with kafka consumer not working?

• Jetson Xavier NX
• DeepStream 5.0
• JetPack Version:4.4

I’m testing the deepstream test5 kafka which consuming a “record” topic, and I publish to kafka topic with python as following code.

from time import sleep
from json import dumps
from kafka import KafkaProducer
import datetime

producer = KafkaProducer(
    bootstrap_servers=['localhost:9092'],
    value_serializer=lambda x: dumps(x).encode('utf-8')
)
for j in range(9999):
    print("Iteration", j)
    dt_now = datetime.datetime.now()
    end_time = dt_now + datetime.timedelta(0,10)
    data = {'command': "stop-recording",
            'start': dt_now.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3]+"Z",
            'end': end_time.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3]+"Z",
            'sensor':{"id":"CAMERA_ID"}
            }
    producer.send('record', value=data)
    sleep(10)

The deepstream test-5 seems like consuming the following.

Consuming message, on topic[record]. Payload ={"command": "stop-recording", "start": "2020-09-14T23:15:27.211Z", "end": "2020-09-14T23:15:37.211Z", "sensor": {"id": "CAMERA_ID"}}

Consuming message, on topic[record]. Payload ={"command": "stop-recording", "start": "2020-09-14T23:15:37.230Z", "end": "2020-09-14T23:15:47.230Z", "sensor": {"id": "CAMERA_ID"}}

But I’m not understand the “start-recording/stop-recording” command which with a “start” and “end” fields. How should I suppose to use this consumer correctly? For using consumer based triggered smart record, should I enable smart-record on camera sources of the deepstream-test5?

Hi Cheesiangleow5284,

Sorry for the late reply, have you clarified the cause and resolve the issue?
Any result can be shared?

Thanks

@kayccc from the smart record documentation it shows that receiving such json message can be use to trigger the smart recording. However i send the json message from python to deepstream-test5, it seems like not triggering the smart record. This kafka message consumer seems like being implemented in deepstream_c2d_msg.c, it shows that nvds_msgapi_connect_callback is empty as following.

static void
nvds_msgapi_connect_callback (NvDsMsgApiHandle h_ptr, NvDsMsgApiEventType ds_evt)
{

}

is this means that the documentation is just telling us that we should implement the smart recording by ourselves or nvidia’s side have an example or something?

HI
You can find smart record usage in sources/apps/apps-common/src/deepstream_source_bin.c, by default, it will be triggered by a timer, depends on the smart record interval you set in config,
you can customize the trigger based on your needs.

Thank you for reply ! I read the source code, it seems like we need to create the smart record by ourselves with the kafka consumer.

Yes.