Deepstream not saving Gstreamer graph

I took the Python example here: deepstream_python_apps/apps/deepstream-rtsp-in-rtsp-out at master · NVIDIA-AI-IOT/deepstream_python_apps · GitHub
I added the following lines right before the print("Starting pipeline \n") :

    # Save graph
    import os
    print(f"Saving pipeline graph in folder {os.environ.get('GST_DEBUG_DUMP_DIR_DIR')}")
    graph_filename = "pipeline"
    Gst.debug_bin_to_dot_file(pipeline, Gst.DebugGraphDetails.ALL, graph_filename)
    graph_filepath = os.path.join(os.environ.get("GST_DEBUG_DUMP_DIR_DIR", ""), graph_filename)
    # os.system(f"dot -Tpng -o {graph_filepath}.png {graph_filepath}.dot")

I started the file with python3 deepstream-rtsp-in-rtsp-out.py -i mystreamurl inside the official deepstream 6.0 container. The stream exists, and the deepstream example runs correctly: I verified it by connecting to the RTSP streams which is generated by the example.
However, the script does not generated the requested pipeline graph. No file is saved and no error is thrown.
Output with GST_DEBUG=3:

0:00:00.063493918     9 0x560327d9eea0 WARN                  ladspa gstladspa.c:507:plugin_init:<plugin48> no LADSPA plugins found, check LADSPA_PATH
0:00:00.261723513     9 0x560327d9eea0 WARN                 default gstsf.c:98:gst_sf_create_audio_template_caps: format 0x120000: 'AVR (Audio Visual Research)' is not mapped
0:00:00.261755860     9 0x560327d9eea0 WARN                 default gstsf.c:98:gst_sf_create_audio_template_caps: format 0x180000: 'CAF (Apple Core Audio File)' is not mapped
0:00:00.261773745     9 0x560327d9eea0 WARN                 default gstsf.c:98:gst_sf_create_audio_template_caps: format 0x100000: 'HTK (HMM Tool Kit)' is not mapped
0:00:00.261795233     9 0x560327d9eea0 WARN                 default gstsf.c:98:gst_sf_create_audio_template_caps: format 0xc0000: 'MAT4 (GNU Octave 2.0 / Matlab 4.2)' is not mapped
0:00:00.261814235     9 0x560327d9eea0 WARN                 default gstsf.c:98:gst_sf_create_audio_template_caps: format 0xd0000: 'MAT5 (GNU Octave 2.1 / Matlab 5.0)' is not mapped
0:00:00.261834125     9 0x560327d9eea0 WARN                 default gstsf.c:98:gst_sf_create_audio_template_caps: format 0x210000: 'MPC (Akai MPC 2k)' is not mapped
0:00:00.261853618     9 0x560327d9eea0 WARN                 default gstsf.c:98:gst_sf_create_audio_template_caps: format 0xe0000: 'PVF (Portable Voice Format)' is not mapped
0:00:00.261873311     9 0x560327d9eea0 WARN                 default gstsf.c:98:gst_sf_create_audio_template_caps: format 0x160000: 'SD2 (Sound Designer II)' is not mapped
0:00:00.261888356     9 0x560327d9eea0 WARN                 default gstsf.c:98:gst_sf_create_audio_template_caps: format 0x190000: 'WVE (Psion Series 3)' is not mapped
0:00:02.771189293     9 0x560327d9eea0 WARN      GST_PLUGIN_LOADING gstplugin.c:792:_priv_gst_plugin_load_file_for_registry: module_open failed: librivermax.so.0: cannot open shared object file: No such file or directory

(gst-plugin-scanner:9): GStreamer-WARNING **: 16:12:39.632: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_udp.so': librivermax.so.0: cannot open shared object file: No such file or directory
0:00:02.785947888     9 0x560327d9eea0 WARN      GST_PLUGIN_LOADING gstplugin.c:792:_priv_gst_plugin_load_file_for_registry: module_open failed: libtritonserver.so: cannot open shared object file: No such file or directory

(gst-plugin-scanner:9): GStreamer-WARNING **: 16:12:39.647: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_inferserver.so': libtritonserver.so: cannot open shared object file: No such file or directory
Creating Pipeline 
 
Creating streamux 
 
Creating source_bin  0  
 
Creating source bin
source-bin-00
d
Creating Pgie 
 
Creating tiler 
 
Creating nvvidconv 
 
Creating nvosd 
 
Creating H264 Encoder
Creating H264 rtppay
Adding elements to Pipeline 


 *** DeepStream: Launched RTSP Streaming at rtsp://localhost:8554/ds-test ***


Saving pipeline graph in folder /shared/
Starting pipeline 

0:00:05.488247978     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<encoder:sink> Unable to try format: Unknown error -1
0:00:05.488280784     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:2937:gst_v4l2_object_probe_caps_for_format:<encoder:sink> Could not probe minimum capture size for pixelformat YM12
0:00:05.488294791     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<encoder:sink> Unable to try format: Unknown error -1
0:00:05.488354991     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:2943:gst_v4l2_object_probe_caps_for_format:<encoder:sink> Could not probe maximum capture size for pixelformat YM12
0:00:05.488385782     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x2dcd4c0 Failed to determine interlace mode
0:00:05.488426383     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<encoder:sink> Unable to try format: Unknown error -1
0:00:05.488466122     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:2937:gst_v4l2_object_probe_caps_for_format:<encoder:sink> Could not probe minimum capture size for pixelformat NM12
0:00:05.488485629     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<encoder:sink> Unable to try format: Unknown error -1
0:00:05.488518005     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:2943:gst_v4l2_object_probe_caps_for_format:<encoder:sink> Could not probe maximum capture size for pixelformat NM12
0:00:05.488539770     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x2dcd4c0 Failed to determine interlace mode
0:00:05.488599071     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<encoder:src> Unable to try format: Unknown error -1
0:00:05.488626732     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:2937:gst_v4l2_object_probe_caps_for_format:<encoder:src> Could not probe minimum capture size for pixelformat H264
0:00:05.488649642     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<encoder:src> Unable to try format: Unknown error -1
0:00:05.488670412     8      0x2dfd470 WARN                    v4l2 gstv4l2object.c:2943:gst_v4l2_object_probe_caps_for_format:<encoder:src> Could not probe maximum capture size for pixelformat H264
0:00:05.623442771     8      0x2dfd470 WARN                 nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::initialize() <nvdsinfer_context_impl.cpp:1161> [UID = 1]: Warning, OpenCV has been deprecated. Using NMS for clustering instead of cv::groupRectangles with topK = 20 and NMS Threshold = 0.5
ERROR: ../nvdsinfer/nvdsinfer_model_builder.cpp:1484 Deserialize engine failed because file path: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine open error
0:00:05.864444456     8      0x2dfd470 WARN                 nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1889> [UID = 1]: deserialize engine from file :/opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed
0:00:05.864523640     8      0x2dfd470 WARN                 nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:1996> [UID = 1]: deserialize backend context from engine from file :/opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed, try rebuild
0:00:05.864545198     8      0x2dfd470 INFO                 nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1914> [UID = 1]: Trying to create engine from model files
WARNING: ../nvdsinfer/nvdsinfer_model_builder.cpp:1210 INT8 not supported by platform. Trying FP16 mode.
WARNING: ../nvdsinfer/nvdsinfer_model_builder.cpp:1224 FP16 not supported by platform. Using FP32 mode.
WARNING: [TRT]: Detected invalid timing cache, setup a local cache instead
0:00:13.506478083     8      0x2dfd470 INFO                 nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1947> [UID = 1]: serialize cuda engine to file: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_fp32.engine successfully
INFO: ../nvdsinfer/nvdsinfer_model_builder.cpp:610 [Implicit Engine Info]: layers num: 3
0   INPUT  kFLOAT input_1         3x368x640       
1   OUTPUT kFLOAT conv2d_bbox     16x23x40        
2   OUTPUT kFLOAT conv2d_cov/Sigmoid 4x23x40         

0:00:13.512908426     8      0x2dfd470 INFO                 nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus:<primary-inference> [UID 1]: Load new model:src_deepstream/deepstream_rtsp_in_rtsp_out/dstest1_pgie_config.txt sucessfully
Decodebin child added: source 

Decodebin child added: decodebin0 

Decodebin child added: rtph264depay0 

Decodebin child added: h264parse0 

Decodebin child added: capsfilter0 

Decodebin child added: nvv4l2decoder0 

0:00:16.589009016     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589052823     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2937:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe minimum capture size for pixelformat MJPG
0:00:16.589081432     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589149149     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2943:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe maximum capture size for pixelformat MJPG
0:00:16.589198472     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589222491     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2937:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe minimum capture size for pixelformat MPG4
0:00:16.589245393     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589265592     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2943:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe maximum capture size for pixelformat MPG4
0:00:16.589295798     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589321168     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2937:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe minimum capture size for pixelformat MPG2
0:00:16.589339521     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589352062     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2943:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe maximum capture size for pixelformat MPG2
0:00:16.589389551     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589410979     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2937:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe minimum capture size for pixelformat H265
0:00:16.589431777     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589454222     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2943:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe maximum capture size for pixelformat H265
0:00:16.589493141     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589672259     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2937:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe minimum capture size for pixelformat VP90
0:00:16.589723867     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589737081     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2943:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe maximum capture size for pixelformat VP90
0:00:16.589780733     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589803566     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2937:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe minimum capture size for pixelformat VP80
0:00:16.589826144     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589846956     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2943:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe maximum capture size for pixelformat VP80
0:00:16.589881914     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589907839     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2937:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe minimum capture size for pixelformat H264
0:00:16.589918458     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:sink> Unable to try format: Unknown error -1
0:00:16.589941645     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2943:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:sink> Could not probe maximum capture size for pixelformat H264
0:00:16.590072419     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:src> Unable to try format: Unknown error -1
0:00:16.590103430     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2937:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:src> Could not probe minimum capture size for pixelformat NM12
0:00:16.590158504     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:3051:gst_v4l2_object_get_nearest_size:<nvv4l2decoder0:src> Unable to try format: Unknown error -1
0:00:16.590439381     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2943:gst_v4l2_object_probe_caps_for_format:<nvv4l2decoder0:src> Could not probe maximum capture size for pixelformat NM12
0:00:16.590470947     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x7fb3d0113150 Failed to determine interlace mode
In cb_newpad

gstname= video/x-raw
features= <Gst.CapsFeatures object at 0x7fb498da5708 (GstCapsFeatures at 0x2431920)>
0:00:16.704464788     8      0x21e4d90 FIXME               basesink gstbasesink.c:3145:gst_base_sink_default_event:<udpsink> stream-start event without group-id. Consider implementing group-id handling in the upstream elements
0:00:16.722553764     8      0x21e4d90 WARN                    v4l2 gstv4l2object.c:4043:gst_v4l2_object_set_format_full:<encoder:sink> Reuse caps framerate 0/1 - fix v4l2 output driver
0:00:16.731264484     8      0x21e4d90 WARN          v4l2bufferpool gstv4l2bufferpool.c:1065:gst_v4l2_buffer_pool_start:<encoder:pool:src> Uncertain or not enough buffers, enabling copy threshold
0:00:16.733159859     8      0x21e4d90 WARN            v4l2videodec gstv4l2videodec.c:1685:gst_v4l2_video_dec_decide_allocation:<nvv4l2decoder0> Duration invalid, not setting latency
0:00:16.733245188     8      0x21e4d90 WARN          v4l2bufferpool gstv4l2bufferpool.c:1065:gst_v4l2_buffer_pool_start:<nvv4l2decoder0:pool:src> Uncertain or not enough buffers, enabling copy threshold
0:00:16.933805329     8 0x7fb3d05a5590 WARN          v4l2bufferpool gstv4l2bufferpool.c:1512:gst_v4l2_buffer_pool_dqbuf:<nvv4l2decoder0:pool:src> Driver should never set v4l2_buffer.field to ANY
0:00:16.971826671     8 0x7fb3d804dcf0 WARN          v4l2bufferpool gstv4l2bufferpool.c:1512:gst_v4l2_buffer_pool_dqbuf:<encoder:pool:src> Driver should never set v4l2_buffer.field to ANY

Please refer to Python DeepStream program not generating dot file - #8 by b.kowshik

Hi @Fiona.Chen , the link you posted is where I actually found the code that it is not working for me. Have you had a chance to try it with Deepstream 6.0?

Found the solution. There is a typo in the example linked. The environment variable for the output folder should be named: GST_DEBUG_DUMP_DOT_DIR and not GST_DEBUG_DUMP_DIR_DIR.