Frame rate drops when saving jpg files in Deepstream 6.2 SDK

Please provide complete information as applicable to your setup.

**• Hardware Platform (Jetson / GPU): Orin NX
**• DeepStream Version: 6.2
**• JetPack Version (valid for Jetson only): 5.1
**• TensorRT Version: 8.5.2.2
**• NVIDIA GPU Driver Version (valid for GPU only): Orin NX
**• Issue Type( questions, new requirements, bugs): Questions

Hi, I fixed the save image function by following Error occurred while saving object to jpg file in Deepstream 6.2 SDK - Intelligent Video Analytics / DeepStream SDK - NVIDIA Developer Forums but when I save the image the frame rate drops.

I use two cameras and save one image every 120 frames. Both cameras have the same specs. The param in the config are set to 1280*720p60.

In addition this application can run at 120fps/2cams on ds6.0/Xavier AGX and DS6.1.1/Orin AGX.

How can I fix it?

**PERF:  FPS 0 (Avg)	FPS 1 (Avg)	
**PERF:  59.93 (51.93)	59.93 (51.93)	
**PERF:  46.33 (51.93)	46.33 (51.93)	
**PERF:  59.90 (51.93)	59.90 (51.93)	
**PERF:  41.03 (51.93)	41.03 (51.93)	
**PERF:  59.88 (51.93)	59.88 (51.93)	
**PERF:  38.10 (51.93)	38.10 (51.93)	
**PERF:  62.93 (51.93)	62.93 (51.93)	
**PERF:  59.96 (51.93)	59.96 (51.93)	
**PERF:  45.72 (51.93)	46.46 (51.93)	
**PERF:  60.02 (51.93)	60.02 (51.93)	
**PERF:  41.79 (51.93)	41.79 (51.93)	
**PERF:  59.92 (51.93)	59.92 (51.93)	
**PERF:  37.92 (51.93)	37.92 (51.93)	
**PERF:  61.87 (51.93)	61.87 (51.93)	
**PERF:  59.58 (51.93)	59.58 (51.93)	
**PERF:  47.16 (51.93)	47.16 (51.93)	
**PERF:  59.72 (51.93)	59.72 (51.93)	
**PERF:  42.64 (51.93)	42.64 (51.93)	
**PERF:  60.02 (51.93)	60.02 (51.93)	
**PERF:  41.98 (51.93)	42.98 (51.93)	

**PERF:  FPS 0 (Avg)	FPS 1 (Avg)	
**PERF:  60.19 (51.93)	60.19 (51.93)	
**PERF:  38.66 (51.93)	38.66 (51.93)	
**PERF:  64.60 (51.93)	64.60 (51.93)	
**PERF:  59.88 (51.93)	59.88 (51.93)	
**PERF:  45.78 (51.93)	45.78 (51.93)	
**PERF:  60.02 (51.93)	60.02 (51.93)	
**PERF:  41.18 (51.93)	41.18 (51.93)	
**PERF:  60.03 (51.93)	60.03 (51.93)	
**PERF:  40.27 (51.93)	40.27 (51.93)	
**PERF:  61.76 (51.93)	61.76 (51.93)	
**PERF:  60.08 (51.93)	60.08 (51.93)	
**PERF:  46.75 (51.93)	46.75 (51.93)	
**PERF:  59.95 (51.93)	59.95 (51.93)	
**PERF:  41.30 (51.93)	41.30 (51.93)	
**PERF:  59.99 (51.93)	59.99 (51.93)	
**PERF:  38.99 (51.93)	38.99 (51.93)	
**PERF:  61.90 (51.93)	61.90 (51.93)	
**PERF:  38.75 (51.93)	38.75 (51.93)	
**PERF:  64.59 (51.93)	63.58 (51.93)	
**PERF:  59.97 (51.93)	59.97 (51.93)

Have you enable max power and lock the clock of the board?

What kind of cameras? CSI, USB or IP camera? What is the spec of the camera?

Do you mean you set the resolution and frame rate of the camera to 1280*720p60? What is the stream format?

I have already enabled max power mode and if “lock the clock” refers to the “sudo jetson_clocks” command, I have also executed it.

USB camera, and the camera spec include 1280720p60 & 19201080p60.

Yes, and the camera streaming format is MJPG.

Can you show us the complete pipeline for your app?

Sorry, could you tell me how to dump the complete pipeline?

Please follow the link DeepStream SDK FAQ - Intelligent Video Analytics / DeepStream SDK - NVIDIA Developer Forums

Thank you for your assistance, and here is my complete pipeline.

You are still using GstJpegDec, why not use the accelerated jpeg decoder such as nvjpegdec or nvv4l2decoder?

There is a bus error problem when using nvjpegdec, similar to the link below.

Please always use the hardware accelerated plugin if possible. Have you tested the result when “nvv4l2decoder mjpeg=1” is used?

Is there performance drop without saving objects as jpeg files?

Is there FPS drop on these platforms?

Where and how did you implement objects saving function? Do you use pad probe after some element to save objects as jpg files just as in the deepstream-image-meta-test sample? Have you observed the same drop with other platforms and DeepStream versions?

If the jpeg file is not saved, performance can be maintained.

The performance can be maintained very well on ds6.0/Xavier AGX and DS6.1.1/Orin AGX.

Have you tried DS6.1.1/Orin NX?

Previously, this app was tested on DS6.1.1/Orin AGX using flash to simulate Orin NX, and its performance was without issue.

To simulate Orin AGX as Orin NX, I followed the methods described on this " Emulation Flash Configurations — Jetson Linux
Developer Guide 34.1 documentation (nvidia.com)
" for simulation.

However, the nvds_obj_enc_process() function differs between DS6.1.1 and DS6.2, and DS6.2 requires additional parameters to use it.

Can you provide your app for us to test the case?

I’m sorry that this cannot be done, but what I can tell you is that the app we used was developed based on the deepstream-app sample from DS6.0, and made modifications to the nvds_obj_enc_create_context(int gpu_id) on DS6.2 before useing it.

And I’m using the the nvds_obj_enc_process() API for saving images in the gie_primary_processing_done_buf_prob() function of the deepstream_app.c file.

Do you save the whole frame or just some objects as jpg files? How offten will the saving happens? Every frame?

I am saving the entire frame and storing it once every 120 frames.

Can you provide the model you are using?