AttributeError: 'NoneType' object has no attribute 'set_property'

Please provide complete information as applicable to your setup.
Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU) nano
• DeepStream Version 7.0
• JetPack Version (valid for Jetson only) 6.0
• TensorRT Version 8.6.2.3-1+cuda12.2
• NVIDIA GPU Driver Version (valid for GPU only) NVIDIA-SMI 540.2.0
• Issue Type( questions, new requirements, bugs) I have implemented python binding,

When I execute code from

Using python commond :

Original Commond
python3 deepstream_test1_rtsp_in_rtsp_out.py -i rtsp://sample_1.mp4 rtsp://sample_2.mp4 rtsp://sample_N.mp4 -g nvinfer

modified Commond :

python3 deepstream_test1_rtsp_in_rtsp_out.py -i rtsp://admin:paymentinapp82@192.168.10.138 -c H264 -b 4000000 -e 0 -g nvinfer

It return error :

encoder.set_property(“bitrate”, bitrate)
AttributeError: ‘NoneType’ object has no attribute ‘set_property’

How to run this program ? rtsp://sample_1.mp4 How to create mp.4 video directly from rtsp . Can be we feed like this ? :) rtsp://admin:paymentinapp82@192.168.10.138 -c H264 -b 4000000 -e 0

If you use Orin nano, the device does not support hardware encoding, please modify the code as follows

diff --git a/apps/deepstream-rtsp-in-rtsp-out/deepstream_test1_rtsp_in_rtsp_out.py b/apps/deepstream-rtsp-in-rtsp-out/deepstream_test1_rtsp_in_rtsp_out.py
index 51379aa..22837e6 100755
--- a/apps/deepstream-rtsp-in-rtsp-out/deepstream_test1_rtsp_in_rtsp_out.py
+++ b/apps/deepstream-rtsp-in-rtsp-out/deepstream_test1_rtsp_in_rtsp_out.py
@@ -238,22 +238,28 @@ def main(args):
         sys.stderr.write(" Unable to create nvvidconv_postosd \n")
 
     # Create a caps filter
+    # caps = Gst.ElementFactory.make("capsfilter", "filter")
+    # caps.set_property(
+    #     "caps", Gst.Caps.from_string("video/x-raw(memory:NVMM), format=I420")
+    # )
     caps = Gst.ElementFactory.make("capsfilter", "filter")
     caps.set_property(
-        "caps", Gst.Caps.from_string("video/x-raw(memory:NVMM), format=I420")
+        "caps", Gst.Caps.from_string("video/x-raw, format=I420")
     )
 
     # Make the encoder
     if codec == "H264":
-        encoder = Gst.ElementFactory.make("nvv4l2h264enc", "encoder")
+        # encoder = Gst.ElementFactory.make("nvv4l2h264enc", "encoder")
+        encoder = Gst.ElementFactory.make("x264enc", "encoder")
         print("Creating H264 Encoder")
     elif codec == "H265":
-        encoder = Gst.ElementFactory.make("nvv4l2h265enc", "encoder")
+        # encoder = Gst.ElementFactory.make("nvv4l2h265enc", "encoder")
+        encoder = Gst.ElementFactory.make("x265enc", "encoder")
         print("Creating H265 Encoder")
     if not encoder:
         sys.stderr.write(" Unable to create encoder")
-    encoder.set_property("bitrate", bitrate)
-    if platform_info.is_integrated_gpu():
+    encoder.set_property("bitrate", bitrate / 1000)
+    if platform_info.is_integrated_gpu() and False:
         encoder.set_property("preset-level", 1)
         encoder.set_property("insert-sps-pps", 1)
         #encoder.set_property("bufapi-version", 1)

Software Encoding is Working :

device model : resnet18_trafficcamnet.etlt_b30_gpu0_int8.engine

When run :

@ubuntu:~/deepstream_python_apps/apps/deepstream-rtsp-in-rtsp-out$ python3 deepstream_test1_rtsp_in_rtsp_out.py -i file:///home/ubuntu/Desktop/nus-2024-vision-main/video/1.mp4 file:///home/ubuntu/Desktop/nus-2024-vision-main/video/2.mp4

Main Error : NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:2129> [UID = 1]: build engine file failed
free(): double free detected in tcache 2
Aborted (core dumped)

It return error : Setting min object dimensions as 16x16 instead of 1x1 to support VIC compute mode.
WARNING: Deserialize engine failed because file path: /home/paymentinapp/deepstream_python_apps/apps/deepstream-rtsp-in-rtsp-out/…/…/…/…/samples/models/Primary_Detector/resnet18_trafficcamnet.etlt_b30_gpu0_int8.engine open error
0:00:08.680420509 10201 0xaaaaea621400 WARN nvinfer gstnvinfer.cpp:679:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:2083> [UID = 1]: deserialize engine from file :/home/paymentinapp/deepstream_python_apps/apps/deepstream-rtsp-in-rtsp-out/…/…/…/…/samples/models/Primary_Detector/resnet18_trafficcamnet.etlt_b30_gpu0_int8.engine failed
0:00:10.152619768 10201 0xaaaaea621400 WARN nvinfer gstnvinfer.cpp:679:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2188> [UID = 1]: deserialize backend context from engine from file :/home/paymentinapp/deepstream_python_apps/apps/deepstream-rtsp-in-rtsp-out/…/…/…/…/samples/models/Primary_Detector/resnet18_trafficcamnet.etlt_b30_gpu0_int8.engine failed, try rebuild
0:00:10.160009823 10201 0xaaaaea621400 INFO nvinfer gstnvinfer.cpp:682:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:2109> [UID = 1]: Trying to create engine from model files
WARNING: INT8 calibration file not specified/accessible. INT8 calibration can be done through setDynamicRange API in ‘NvDsInferCreateNetwork’ implementation
NvDsInferCudaEngineGetFromTltModel: Failed to open TLT encoded model file /home/paymentinapp/deepstream_python_apps/apps/deepstream-rtsp-in-rtsp-out/…/…/…/…/samples/models/Primary_Detector/resnet18_trafficcamnet.etlt
ERROR: Failed to create network using custom network creation function
ERROR: Failed to get cuda engine from custom library API
0:00:22.596495955 10201 0xaaaaea621400 ERROR nvinfer gstnvinfer.cpp:676:gst_nvinfer_logger: NvDsInferContext[UID 1]: Error in NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:2129> [UID = 1]: build engine file failed
free(): double free detected in tcache 2
Aborted (core dumped)

Jetpack is not installed correctly, TensorRT cannot work, it is recommended to re-burn Jetpack.

When I run ppl net , its working. How both can be conflicts ? one is working and one is not working.

What is ppl net?

peoplenet