Error when saving whole image in or after nvdsosd

• Hardware Platform (Jetson / GPU) Jetson Nano
• DeepStream Version 6.0.1

I want to save the image after drawing bbox/label on the image. But if I add a pad probe function in/after nvdsosd; in probe function: I call nvds_obj_enc_process and nvds_obj_enc_finish to save the whole image. System will error: Segmentation Fault

I attached 2 files that you can run to check: (Please rename main2.txt → main2.cpp to run)
CMakeLists.txt (1.0 KB)
main2.txt (10.8 KB)

I have run your code on my env (JP6.1 & DeepStream7.1 ), it runs well without any segmentation. The version of DeepStream you are using is too old. Can you consider other options to fulfill your needs?
You can refer to this 323790 to try to use multifilesink to save all the images.

Thanks. I think I will use OpenCV to save for better