Accumulated latency and crash application in jetson nano

Hello, I’m currently facing some significant latency and crashing issues with my Jetson Nano. The project involves getting video feeds from four IP cameras, processing the video with nvinfer, and then using the data for two purposes: transmitting the video via rtsp and sharing the metadata using Kafka. I have already set up the rtsp and Kafka server on the Jetson. I need this video to be as real-time as I can.

In the transmitted video you can see that it is like slow motion, it means that it is processing all the data that is receiving and not the last data that has been received. Here is a video demonstrating this issue

and about the other problem, when the program starts to send data via kafka producer it crashes with no error message. You can watch it here

The code used is this:

Hi,
Please check if you use latest Jetpack 4.6.3. If not, we would suggest upgrade and give it a try. And before the test please run sudo jetson_clocks to get maximum throughput of the system.