SOLVED: linking pads from multiqueue to splitmuxsink?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

SOLVED: linking pads from multiqueue to splitmuxsink?

killerrats
This post was updated on .
gst-launch-1.0 -e --gst-debug=3

udpsrc address=[IP] port=[PORT] caps=application/x-rtp,media=audio !
rtppcmudepay ! audioparse rate=8000 channels=1 rate=32000 ! audioconvert !
avenc_aac ! aacparse ! tee name=atee ! mq.sink_2

udpsrc address=[IP] port=[PORT]
caps=application/x-rtp,media=video,payload=90000 ! queue ! rtpmp4vdepay !
mpeg4videoparse ! tee name=vtee

! mq.sink_1 multiqueue name=mq mq.src_1 ! mux.video splitmuxsink name=mux
muxer=mp4mux sink=filesink max-size-bytes=20971520 max-files=360
location=c:/temp/video%04d.mp4

mq.src_2 ! mux.audio_1 -v

this pipeline is successful in the command line but when I create the
elements and join them it won't work on the audio side.

when I join the mq.src_2 -> mux.audio_1 it says wrong hierarchy. Both udpsrc
are in the same bin. If I only use the video side it will work. this is
setting up the pipeline before playing. I will use similar way for the rest
of the pad linking in the pipeline to join the elements. Anybody know a
reason?

GstElement* mq = gst_element_get_static_pad(this->srcPipeline,
V_MULTIQUEUE_NAME);
GstElement* mux = gst_element_get_static_pad(this->srcPipeline,
V_MUXER_NAME);
GstPad* srcPad = gst_element_get_static_pad(mq, "src_2");
GstPad* sinkPad = gst_element_get_request_pad(mux, "audio_1");

if (gst_pad_link(srcPad, sinkPad) != GST_PAD_LINK_OK)
{
check = false;
}

Error Message:
Linking multiqueue src_2 to mp4mux audio_1
0:00:04.427642300 45592   0B01C240 INFO                GST_PADS
gstpad.c:2378:gst_pad_link_prepare: trying to link multiqueue:src_2 and
mp4mux:audio_1
0:00:04.428188500 45592   0B01C240 INFO                GST_PADS
gstpad.c:2427:gst_pad_link_prepare: pads have wrong hierarchy
0:00:04.432571800 45592   0B01C240 INFO                GST_PADS
gstpad.c:2529:gst_pad_link_full: link between multiqueue:src_2 and
mp4mux:audio_1 failed: wrong hierarchy



-----
------------------------------
Gstreamer 1.14.3
------------------------------
Windows
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
------------------------------
Gstreamer 1.14.3
------------------------------
Windows
Reply | Threaded
Open this post in threaded view
|

Re: linking pads from multiqueue to splitmuxsink?

Mathieu Duponchelle
GstElement* mq = gst_element_get_static_pad


That looks fishy ;)

<https://gstreamer.freedesktop.org/documentation/gstreamer/gstbin.html?gi-language=c#gst_bin_get_by_name>,
or better yet, don't use gst_parse_launch to construct your pipeline.


On 8/28/19 8:54 PM, killerrats wrote:

> gst-launch-1.0 -e --gst-debug=3
>
> udpsrc address=[IP] port=[PORT] caps=application/x-rtp,media=audio !
> rtppcmudepay ! audioparse rate=8000 channels=1 rate=32000 ! audioconvert !
> avenc_aac ! aacparse ! tee name=atee ! mq.sink_2
>
> udpsrc address=[IP] port=[PORT]
> caps=application/x-rtp,media=video,payload=90000 ! queue ! rtpmp4vdepay !
> mpeg4videoparse ! tee name=vtee
>
> ! mq.sink_1 multiqueue name=mq mq.src_1 ! mux.video splitmuxsink name=mux
> muxer=mp4mux sink=filesink max-size-bytes=20971520 max-files=360
> location=c:/temp/video%04d.mp4
>
> mq.src_2 ! mux.audio_1 -v
>
> this pipeline is successful in the command line but when I create the
> elements and join them it won't work on the audio side.
>
> when I join the mq.src_2 -> mux.audio_1 it says wrong hierarchy. Both udpsrc
> are in the same bin. If I only use the video side it will work. this is
> setting up the pipeline before playing. I will use similar way for the rest
> of the pad linking in the pipeline to join the elements. Anybody know a
> reason?
>
> GstElement* mq = gst_element_get_static_pad(this->srcPipeline,
> V_MULTIQUEUE_NAME);
> GstElement* mux = gst_element_get_static_pad(this->srcPipeline,
> V_MUXER_NAME);
> GstPad* srcPad = gst_element_get_static_pad(mq, "src_2");
> GstPad* sinkPad = gst_element_get_request_pad(mux, "audio_1");
>
> if (gst_pad_link(srcPad, sinkPad) != GST_PAD_LINK_OK)
> {
> check = false;
> }
>
> Error Message:
> Linking multiqueue src_2 to mp4mux audio_1
> 0:00:04.427642300 45592   0B01C240 INFO                GST_PADS
> gstpad.c:2378:gst_pad_link_prepare: trying to link multiqueue:src_2 and
> mp4mux:audio_1
> 0:00:04.428188500 45592   0B01C240 INFO                GST_PADS
> gstpad.c:2427:gst_pad_link_prepare: pads have wrong hierarchy
> 0:00:04.432571800 45592   0B01C240 INFO                GST_PADS
> gstpad.c:2529:gst_pad_link_full: link between multiqueue:src_2 and
> mp4mux:audio_1 failed: wrong hierarchy
>
>
>
> -----
> ------------------------------
> Gstreamer 1.14.3
> ------------------------------
> Windows
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: linking pads from multiqueue to splitmuxsink?

killerrats
This post was updated on .
edited the code. i put the wrong call in the post.
gst-launch-1.0 -e --gst-debug=3 udpsrc address=[IP] port=[PORT] caps=application/x-rtp,media=audio ! rtppcmudepay ! audioparse rate=8000 channels=1 rate=32000 ! audioconvert ! avenc_aac ! aacparse ! tee name=atee ! mq.sink_2 udpsrc address=[IP] port=[PORT] caps=application/x-rtp,media=video,payload=90000 ! queue ! rtpmp4vdepay ! mpeg4videoparse ! tee name=vtee ! mq.sink_1 multiqueue name=mq mq.src_1 ! mux.video splitmuxsink name=mux muxer=mp4mux sink=filesink max-size-bytes=20971520 max-files=360 location=c:/temp/video%04d.mp4 mq.src_2 ! mux.audio_1 -v this pipeline is successful in the command line but when I create the elements and join them it won't work on the audio side. when I join the mq.src_2 -> mux.audio_1 it says wrong hierarchy. Both udpsrc are in the same bin. If I only use the video side it will work. this is setting up the pipeline before playing. I will use similar way for the rest of the pad linking in the pipeline to join the elements. Anybody know a reason? GstElement* mq = gst_bin_get_by_name(this->srcPipeline, V_MULTIQUEUE_NAME); GstElement* mux = gst_bin_get_by_name(this->srcPipeline, V_MUXER_NAME); GstPad* srcPad = gst_element_get_static_pad(mq, "src_2"); GstPad* sinkPad = gst_element_get_request_pad(mux, "audio_1"); if (gst_pad_link(srcPad, sinkPad) != GST_PAD_LINK_OK) { check = false; } Error Message: Linking multiqueue src_2 to mp4mux audio_1 0:00:04.427642300 45592 0B01C240 INFO GST_PADS gstpad.c:2378:gst_pad_link_prepare: trying to link multiqueue:src_2 and mp4mux:audio_1 0:00:04.428188500 45592 0B01C240 INFO GST_PADS gstpad.c:2427:gst_pad_link_prepare: pads have wrong hierarchy 0:00:04.432571800 45592 0B01C240 INFO GST_PADS gstpad.c:2529:gst_pad_link_full: link between multiqueue:src_2 and mp4mux:audio_1 failed: wrong hierarchy
----- ------------------------------ Gstreamer 1.14.3 ------------------------------ Windows -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list gstreamer-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
------------------------------
Gstreamer 1.14.3
------------------------------
Windows
Reply | Threaded
Open this post in threaded view
|

Re: linking pads from multiqueue to splitmuxsink?

killerrats
In reply to this post by Mathieu Duponchelle
edited the code for the post. made a mistake.

gst-launch-1.0 -e --gst-debug=3

udpsrc address=[IP] port=[PORT] caps=application/x-rtp,media=audio !
rtppcmudepay ! audioparse rate=8000 channels=1 rate=32000 ! audioconvert !
avenc_aac ! aacparse ! tee name=atee ! mq.sink_2

udpsrc address=[IP] port=[PORT]
caps=application/x-rtp,media=video,payload=90000 ! queue ! rtpmp4vdepay !
mpeg4videoparse ! tee name=vtee

! mq.sink_1 multiqueue name=mq mq.src_1 ! mux.video splitmuxsink name=mux
muxer=mp4mux sink=filesink max-size-bytes=20971520 max-files=360
location=c:/temp/video%04d.mp4

mq.src_2 ! mux.audio_1 -v

this pipeline is successful in the command line but when I create the
elements and join them it won't work on the audio side.

when I join the mq.src_2 -> mux.audio_1 it says wrong hierarchy. Both udpsrc
are in the same bin. If I only use the video side it will work. this is
setting up the pipeline before playing. I will use similar way for the rest
of the pad linking in the pipeline to join the elements. Anybody know a
reason?

*
GstElement* mq = gst_bin_get_by_name(this->srcPipeline,
V_MULTIQUEUE_NAME);
GstElement* mux = gst_bin_get_by_name(this->srcPipeline,
V_MUXER_NAME);
*
GstPad* srcPad = gst_element_get_static_pad(mq, "src_2");
GstPad* sinkPad = gst_element_get_request_pad(mux, "audio_1");

if (gst_pad_link(srcPad, sinkPad) != GST_PAD_LINK_OK)
{
check = false;
}

Error Message:
Linking multiqueue src_2 to mp4mux audio_1
0:00:04.427642300 45592   0B01C240 INFO                GST_PADS
gstpad.c:2378:gst_pad_link_prepare: trying to link multiqueue:src_2 and
mp4mux:audio_1
0:00:04.428188500 45592   0B01C240 INFO                GST_PADS
gstpad.c:2427:gst_pad_link_prepare: pads have wrong hierarchy
0:00:04.432571800 45592   0B01C240 INFO                GST_PADS
gstpad.c:2529:gst_pad_link_full: link between multiqueue:src_2 and
mp4mux:audio_1 failed: wrong hierarchy



-----
------------------------------
Gstreamer 1.14.3
------------------------------
Windows
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
------------------------------
Gstreamer 1.14.3
------------------------------
Windows
Reply | Threaded
Open this post in threaded view
|

Re: linking pads from multiqueue to splitmuxsink?

Mathieu Duponchelle
This is not enough context to provide a definitive answer, but look into why
mux isn't actually splitmuxsink but mp4mux at linking time.

On 8/28/19 10:25 PM, killerrats wrote:

> edited the code for the post. made a mistake.
>
> gst-launch-1.0 -e --gst-debug=3
>
> udpsrc address=[IP] port=[PORT] caps=application/x-rtp,media=audio !
> rtppcmudepay ! audioparse rate=8000 channels=1 rate=32000 ! audioconvert !
> avenc_aac ! aacparse ! tee name=atee ! mq.sink_2
>
> udpsrc address=[IP] port=[PORT]
> caps=application/x-rtp,media=video,payload=90000 ! queue ! rtpmp4vdepay !
> mpeg4videoparse ! tee name=vtee
>
> ! mq.sink_1 multiqueue name=mq mq.src_1 ! mux.video splitmuxsink name=mux
> muxer=mp4mux sink=filesink max-size-bytes=20971520 max-files=360
> location=c:/temp/video%04d.mp4
>
> mq.src_2 ! mux.audio_1 -v
>
> this pipeline is successful in the command line but when I create the
> elements and join them it won't work on the audio side.
>
> when I join the mq.src_2 -> mux.audio_1 it says wrong hierarchy. Both udpsrc
> are in the same bin. If I only use the video side it will work. this is
> setting up the pipeline before playing. I will use similar way for the rest
> of the pad linking in the pipeline to join the elements. Anybody know a
> reason?
>
> *
> GstElement* mq = gst_bin_get_by_name(this->srcPipeline,
> V_MULTIQUEUE_NAME);
> GstElement* mux = gst_bin_get_by_name(this->srcPipeline,
> V_MUXER_NAME);
> *
> GstPad* srcPad = gst_element_get_static_pad(mq, "src_2");
> GstPad* sinkPad = gst_element_get_request_pad(mux, "audio_1");
>
> if (gst_pad_link(srcPad, sinkPad) != GST_PAD_LINK_OK)
> {
> check = false;
> }
>
> Error Message:
> Linking multiqueue src_2 to mp4mux audio_1
> 0:00:04.427642300 45592   0B01C240 INFO                GST_PADS
> gstpad.c:2378:gst_pad_link_prepare: trying to link multiqueue:src_2 and
> mp4mux:audio_1
> 0:00:04.428188500 45592   0B01C240 INFO                GST_PADS
> gstpad.c:2427:gst_pad_link_prepare: pads have wrong hierarchy
> 0:00:04.432571800 45592   0B01C240 INFO                GST_PADS
> gstpad.c:2529:gst_pad_link_full: link between multiqueue:src_2 and
> mp4mux:audio_1 failed: wrong hierarchy
>
>
>
> -----
> ------------------------------
> Gstreamer 1.14.3
> ------------------------------
> Windows
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: linking pads from multiqueue to splitmuxsink?

Vinod Kesti
In reply to this post by killerrats
killerrats,



You are retrieving the mq.src_2 pad wrongly.  source pads are some time pad.
Use pad-added call back to link splitmusink to mq.

Below is the pad template.
Pad Templates:
  SRC template: 'src_%u'
    Availability: Sometimes
    Capabilities:
      ANY

  SINK template: 'sink_%u'
    Availability: On request
    Capabilities:
      ANY



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: linking pads from multiqueue to splitmuxsink?

killerrats
I have successfully linked the pads. when I use the "pad-added" signal for
video and audio will not link. If i use the "pad-added" for audio only and
link the video pad before the signal will work like i was doing before. for
example:

setup the main pipeline
link the main pipeline including the multiqueue to splitmuxsink for video
setup the signal for splitmuxsink

void cb_new_Multiqueue_pad(GstElement* element, GstPad* pad, gpointer data)
{
        gchar *name;
        gchar *fromCaps;
        GstPad* sinkPad = NULL;
        GstCaps * p_caps;
        GstElement* nextElement = nullptr;
        DvtelPipeline* pipe = static_cast<DvtelPipeline*>(data);
        name = gst_pad_get_name(pad);
        p_caps = gst_pad_get_pad_template_caps(pad);
        fromCaps = gst_caps_to_string(p_caps);
        g_print("A new pad %s was created\n", name);
        g_print("\r\ncaps are %" GST_PTR_FORMAT, fromCaps);
        g_print("\r\n");

        if (strstr(name, "src") == NULL)
                goto End;

        if (strstr(name, "src_2") != NULL)
        {
                std::cout << "\n------------------------ multiqueue audio
-------------------------------\n";

                nextElement = gst_bin_get_by_name(GST_BIN(pipe->srcPipeline),
"splitmuxsink");
                if (nextElement != NULL)
                {
                        sinkPad = pipe->RequestingPadFromElement(nextElement, "audio_1");

                        pipe->LinkingThePads(pad,sinkPad);
                        gst_object_unref(nextElement);
                }
        }
        else
        {
                g_print("Couldn't find video or audio in caps from string\n");
        }

End:
        {
            g_free(fromCaps);
            g_free(name);
            gst_caps_unref(p_caps);
            gst_object_unref(sinkPad);
        }
}



-----
------------------------------
Gstreamer 1.14.3
------------------------------
Windows
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
------------------------------
Gstreamer 1.14.3
------------------------------
Windows