Video write has frames dropped. Any faster way to record detectnet output on Jetson Nano?

I’m using detectnet with my own model to output a video which I want to be saved into an mp4 file (with the detections and my custom additions on the frame).

At the moment, I’m launching detectnet like this:

./detectnet.py --model=/home/aerodynamika/Programs/jetson-inference/python/training/detection/ssd/models/eightos-knife-body-first-try/ssd-mobilenet.onnx --labels=/home/aerodynamika/Programs/jetson-inference/python/training/detection/ssd/models/eightos-knife-body-first-try/labels.txt --input-blob=input_0 --output-cvg=scores --output-bbox=boxes "/home/aerodynamika/Programs/opencv-eightos/videos/knife-body.mp4" "/home/aerodynamika/Programs/opencv-eightos/videos/knife-body-detectnet-2.mp4" --threshold=0.1 

It creates a stream and outputs the file to knife-body-detectnet-2.mp4 but it has frames dropped and it’s not complete video.

I’m using this to write:

output = jetson.utils.videoOutput(opt.output_URI, argv=sys.argv+is_headless)
# here some code to detect and to process the image
output.Render(out_img)

is there a way to output and record a video that is faster and won’t have frames dropped? I heard I could do it with gstreamer but how?

Hi,

Would you mind trying our Deepstream SDK which is designed for the multimedia pipeline?

You can find an example for integrating a detectnet-based model with Deepstream:
https://elinux.org/Jetson/L4T/TRT_Customized_Example#Custom_Parser_for_SSD-MobileNet_Trained_by_Jetson-inference

Thanks.

1 Like

Aasta is correct that DeepStream will have higher performance, and the link she gave shows how to use SSD-Mobilenet ONNX with DeepStream.

With jetson-inference, I recently made enhancements to use NVMM memory in multimedia pipeline (see commit 21a200, so you may try it and find it has better performance. You will want to re-clone and rebuild/reinstall the repo to try the changes.

Also, jetson-inference has a LIFO policy (last in first out) with streaming buffers from camera/video/ect. This is because it’s primarily meant to keep the latency down during realtime camera streaming. So if the processing gets behind the stream, it will drop the older buffers.