How flvdemux and other plugins are linked together in Gstreamer?

Hello.I try to use Gstreamer in python. I just want the pipeline like RTMP source → flvdemux → fakesink.But it doesn’t work.
This is the output

Creating Pipeline 
Creating Source And other 
Adding elements to Pipeline 

Linking elements in the Pipeline 

Starting pipeline 

0:00:03.159383897 16325   0x55af55fb20 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<rtmp-source> error: Internal data stream error.
0:00:03.159478234 16325   0x55af55fb20 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<rtmp-source> error: streaming stopped, reason not-linked (-1)
Error: gst-stream-error-quark: Internal data stream error. (1): gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstRTMPSrc:rtmp-source:
streaming stopped, reason not-linked (-1)

This my code

import sys
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
from common.bus_call import bus_call
import os
os.environ["GST_DEBUG_DUMP_DOT_DIR"] = "/tmp"
os.putenv('GST_DEBUG_DUMP_DIR_DIR', '/tmp')

def main(args):


    print("Creating Pipeline \n ")
    pipeline = Gst.Pipeline()
    if not pipeline:
        sys.stderr.write(" Unable to create Pipeline \n")

    print("Creating Source And other \n ")
    source = Gst.ElementFactory.make("rtmpsrc", "rtmp-source")
    if not source:
        sys.stderr.write(" Unable to create Source \n")
    flvdemux1 = Gst.ElementFactory.make("flvdemux", "flv-demux")
    if not flvdemux1:
        sys.stderr.write(" Unable to create flvdemux \n")
    fakesink = Gst.ElementFactory.make("fakesink", "fake-sink")
    if not fakesink:
        sys.stderr.write(" Unable to create fake sink \n")

    source.set_property('location', 'rtmp:// live=1')
    print("Adding elements to Pipeline \n")
    print("Linking elements in the Pipeline \n")
    # create an event loop and feed gstreamer bus mesages to it
    loop = GObject.MainLoop()
    bus = pipeline.get_bus()
    bus.connect("message", bus_call, loop)

    Gst.debug_bin_to_dot_file(pipeline, Gst.DebugGraphDetails.ALL, "pipeline")

    # start play back and listen to events
    print("Starting pipeline \n")
    # cleanup

if __name__ == '__main__':

And my pipeline.png tell me that the flvdemux doesn’t link to fakesink.Please help me.

This is my gst command’s pipeline png. The flvdemux has “video” part

Why my code can’t gei it?Please help me .

I found this, i think maybe it’s the same problem.But it’s a long time away from now, can someone tell me how to do?

You would need to link the pad dynamically as mentioned in this discussion thread:
c - Gstreamer:dynamically link realize - Stack Overflow

Suggest try it in C code first to have a working C sample, and then apply to python.

I only use python…I know the discussion says, but i don’t know how to apply to python.Any other example?

Found a sample with qtdemux. Please take a look and give it a try:
python - Seamless video loop in gstreamer - Stack Overflow

THANKS!! Problem solved

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.