What is the most efficient way to record video or save images?

I currently have a computer vision project where I do realtime detection on robots. I want to save the image I grab from the camera before detecting the objects so I have more images to add to my dataset. What is the most efficient way to achieve this in terms of not sacrificing my detection speed and not storing too many images in ram at once? I currently use tensorRT for my inference model (yolov4 tiny) if that affects anything. I’ve heard of nvenc and my codebase is written in python but I am unsure on what to do so I would appreciate any steps or help in the right direction. Thanks!

Hi,
We would suggest try DeepStream SDK. For saving to a video file, you can set type=3 in Sink Group. Please check
DeepStream Reference Application - deepstream-app — DeepStream 6.1.1 Release documentation

For running yolov4 tiny in DeepStream SDK, please refer to
Jetson/L4T/TRT Customized Example - eLinux.org

Thank you, I’ve also heard of cudacodec videowriter. Would this be an option if I compile ffmpeg and then compile opencv with the ffmpeg backend with my codebase being in python? After compiling I would use cudacodec videowriter. I will be using using opencv 4.5.

Hi,
We are not sure if cv::cudacodec::VideoWriter works on Jetson platforms. Probably the encoder is implemented through CUDA to utilize GPU. You may rebuild OpenCV and give it a try.

There is individual encoding engine and generally we run gstreamer command to leverage hardware encoding. May refer to this sample
Displaying to the screen with OpenCV and GStreamer - #9 by DaneLLL

The gstreamer idea was perfect. Thanks a ton!