How to buffer output from jetson video feed?

We are using jetson to do multiple CV tasks on videos with a bunch of models recently. The video is dislpayed with the result. We are doing this now with Python.

We do the job the same way with jetson inference examples, but the models are taking too long to proceed. To make sure the models do not slow down the video play, we put the inference part in a subprocess that only deal with one frame at a time and ignore the others. Because a lot of frames would already been displayed when the inference result returns, we use a queue to store all the frames, by extracting numpy array from cuda and converting it back to cuda fo display. So that we can match the result with exact the frame that was used for inference.

The problem is that, the screen display is always lagging during the process. It seems that the numpy array from jetson.utils.cudaFromNumpy function refers to the same address all the time, and to keep the numpy frame in memory for long enough, we use np.copy to make a second copy of the frame. When the copy takes too long to finish, the screen begins to lag.

So what we are trying to figure out now is, in our situation, is there a way not to copy between cuda and memory all the time, or is there way to delay the whole video display for a few seconds without using Python Queue?

Hi @zhobin8, rather than make additional memory copies, you should be able to increase the amount of input buffers with the --num-buffers=4 command-line option (the default is 4).