Surpass Synchronous Probe Function for Real-Time Frame Encoding

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) GPU
• DeepStream Version 6.3
• NVIDIA GPU Driver Version (valid for GPU only) 530.30.02
• Issue Type( questions, new requirements, bugs) questions

Hi everyone,

I’m currently working on a project where I need to handle video frames in real-time. I’m using a probe function in a DeepStream Python pipeline to get frames, but I’m encountering an issue with the synchronous nature of the probe function. My goal is to process these frames in the probe function, encode them to bytes, and send them via Redis stream in a non-blocking manner.

Here’s the basic flow I’m trying to achieve:

  1. Capture frames in the probe function.
  2. Encode the frames to bytes (using a format like JPEG).
  3. Send the encoded frame to Redis (using Streams).

The problem is that the probe function is synchronous, which blocks the pipeline while the frames are being encoded and sent. This creates performance bottlenecks and introduces latency.

Has anyone dealt with this issue before? How can I:

  • Make the probe function asynchronous so that encoding and sending frames via Redis happens in a separate thread?
  • Or alternatively, bypass the synchronous nature while still ensuring real-time frame processing?

Any suggestions or best practices on how to efficiently handle this in real-time systems would be greatly appreciated!

Thanks in advance!

Will these processing be done for every frame in every bacth?

Before you doing that, has the performance of the whole “capture+encoding+sending to Redis” been measured? If the time of this processing is longer than the 1/framerate time and you need to encode and send every frame in every batch, even the asychronization processing can’t help your case. Your “queue” for storing the frames for the other thread will continuing increase because the processing thread can’t consume the frame buffers in time.

Probe function is a callback which is triggered by the pipeline’s internal events. Its synchronous nature can’t be changed. Seems python supports multithreading. You may google by yourself. threading — Thread-based parallelism — Python 3.13.0 documentation
Multithreading in Python - GeeksforGeeks

  1. Yes, the processing will be done for each frame in every batch.
  2. The total time for capture + encoding + sending to Redis is less than the time for 1/framerate.

The extra buffer allocation and memory copy should also be counted if you need to implement the asynchronization method.

Thanks in advance. My application needs to run multiple streams concurrently. Could you tell me the best practices for the above process?

DeepStream already handles the multiple streams inputs in batch. You need to gurantee the total time of the whole “capture+encoding+sending to Redis” processing for all the frames in the batch is less than 1/framerate.

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.