About dynamic link with a rtspsrc

Hi, I tried to use a CCTV cam with gstreamer recently. And I get a GST_PAD_LINK_NOFORMAT error when i tried to dynamically link a stream_%u pad to parse264 at the second time I created the same pipeline. Here is my python call-back function:

def video_newpad(src, pad, det)
    vdec_pad = det.get_static_pad("sink")

Despite I still get frame data from pipeline, I still need to fix it. Before the program exit, I just called pipeline.set_state(Gst.State.NULL). I wonder if the resource was not released.

rtspsrc outputs data in form of RTP packets (application/x-rtp media type).

You need to first plug a depayloader such as e.g. rtph264depay which will re-assemble the RTP packets into H.264 video data. After that you can then plug h264parse and a decoder.

Hello, thanks for your suggestion. This dynamic link is established for rtspsrc and rtph264depay. Here is my pipeline building method:

def cb_video_newpad(src, pad, dst):
    vdec_pad = dst.get_static_pad("sink")
    if not vdec_pad.is_linked():
    # new_caps = pad.get_current_caps()
    # new_pad_struct = new_caps.get_structure(0)
    # new_pad_type = new_pad_struct.get_name()

def create_nv_pipeline(name, rtsp_path,framedata):
    # create pipe
    # create elements
    pipe = Gst.Pipeline.new(name)
    src = Gst.ElementFactory.make("rtspsrc", "src")
    src.set_property("location", rtsp_path)
    #src.set_property("location", "rtsp://admin:Dh123456@")
    src.set_property("latency", 50)

    parse264 = Gst.ElementFactory.make("rtph264depay", "parse264")
    decodebin = Gst.ElementFactory.make("nvv4l2decoder", "decodebin")
    conv = Gst.ElementFactory.make("nvvidconv", "conv")
    caps = Gst.caps_from_string("video/x-raw, format=(string)BGRx")
    filter = Gst.ElementFactory.make("capsfilter", "filter")
    filter.set_property("caps", caps)
    conv2 = Gst.ElementFactory.make("videoconvert", "conv2")
    sink = Gst.ElementFactory.make("appsink", "sink")

    # config the appsink
    sink.set_property("emit-signals", True)
    sink.connect("new-sample", new_buffer, framedata)

    # add elements

    # link elements
    src.connect("pad-added", cb_video_newpad, parse264)
    # src.connect("pad-added", cb_demuxer_newpad, parse264)

    return pipe

Please forgive me, I haven’t mentioned it before.

How sure are you that the stream you’re linking is actually an H.264 RTP stream?

Does it work / link if you just have rtspsrc ! rtph264depay ! fakesink (or appsink without caps specified)?

You could check the GST_DEBUG=*:6 log to see what it shows during the linking (you can also enable the debug log programmatically just before you link and disable right after in order to only get the info you need).