Unable to link Nvstreamdemux with rtph264pay element using PyGObject

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson
• DeepStream Version 5.0
• JetPack Version (valid for Jetson only) 4.4
• TensorRT Version 7.0
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs) questions
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
print(“Linking demux to the rtppayload in the Pipeline \n”)
for i in range(number_of_sources):
demux_srcpad = streamdemux.get_request_pad(“src_%u”%i)
if not demux_srcpad:
sys.stderr.write(“Unable to get the src pad of streamdemux \n”)
sinkpad = rtppayload_list[i].get_static_pad(“sink”)
if not sinkpad:
sys.stderr.write(" Unable to get sink pad of rtppayload \n")
demux_srcpad.link(sinkpad)

• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

I am trying to create source pads for the nvstreamdemux element at run-time and link to several rtph264pay elements which reside inside the list : rtppayload_list. The above given code results in the following error:
gi.overrides.Gst.LinkError:

Any help would be appreciated. Thanks !

Do you know Gstreamer Caps? https://gstreamer.freedesktop.org/documentation/additional/design/caps.html?gi-language=c

Only the two pads support the same caps, these two pads can be connected.

Please run “gst-inspect-1.0 rtph264pay”, the sink pad needs the following caps:
SINK template: ‘sink’
Availability: Always
Capabilities:
video/x-h264
stream-format: avc
alignment: au
video/x-h264
stream-format: byte-stream
alignment: { (string)nal, (string)au }

But nvstreamdemux src pad needs the following caps:
SRC template: ‘src_%u’
Availability: On request
Capabilities:
video/x-raw(memory:NVMM)
format: { (string)NV12, (string)RGBA }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]

You can never connect them.

Please study gstreamer basic concept and knowledge before you start with deepstream.

Hey, thanks for the clarification. Btw I am new to Gstreamer. So I switched out the rpth264pay with an Nvv4l2h264enc element whose sink pads match the src pads for nvstreamdemux:

Nvv4l2h264enc
SINK template: ‘sink’
Availability: Always
Capabilities:
video/x-raw(memory:NVMM)
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
format: { (string)I420, (string)NV12, (string)P010_10LE }
framerate: [ 0/1, 2147483647/1 ]

But the script throws the error :
gi.overrides.Gst.LinkError enum GST_PAD_LINK_WRONG_DIRECTION of type Gst.PadLinkReturn

How can I resolve this?

You need to check your codes. I can’t know anything just with the error log.

Hey Fiona, I am attaching my script for your reference. Any help will be appreciated. My final aim is to mux together several MIPI camera streams and then sending them out as separate RTSP streams by using demux.stream-app.zip (2.2 KB)

According to your codes, you want to build the following pipeline:

Nvarguscamerasrc->nvstreammux-> nvvideoconvert-> capsfilter(video/x-raw(memory:NVMM), format=NV12, width=3280, height=2464, framerate=21/1)->nvstreamdemux->nvv4l2h264enc->rtph264pay->udpsink

The nvstreademux 's src pad should be linked to nvv4l2h264enc 's sink pad. But in the line 114, you link nvv4l2h264enc 's sink pad to nvstreademux 's src pad. So it is wrong.
“demux_srcpad.link(sinkpad)” is correct.

Please do not use nvvideoconvert to convert the nvstreammux output. nvstreammux can do scaling inside, just setting “width” and “height” properties of nvstreammux https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvstreammux.html#gst-properties

Please do not set “framerate” with capsfilter, you are using camera as source, the framerate can not be set in this way.

Please enable “live-source” property of nvstreammux, since camera using the live source.

1 Like

Thanks @Fiona.Chen, that worked.