Could not link ffdemux_mpegts0 to videoqueue

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

Could not link ffdemux_mpegts0 to videoqueue

gagankumarnigam
Hi all,

I tried to recieve mpeg2ts video stream (RTP/UDP) using the pipeline given
below. Successfully recieve the video

gst-launch udpsrc port=51000
caps="application/x-rtp,media=video,payload=33,clock-rate=90000,
encoding-name=MP2TS " ! rtpmp2tdepay ! mpegtsdemux ! queue !
ffdec_mpeg2video ! ffmpegcolorspace ! xvimagesink

But when i try to transform the same pipeline in c code i got error :
 Could not link ffdemux_mpegts0 to videoqueue.

Here is my code given below. Can some body help me out what is the problem
here.


#define VIDEO_CAPS
"application/x-rtp,media=video/mpegts,payload=(int)33,clock-rate=(int)90000,
encoding-name=MP2TS"
#define VIDEO_SINK  "xvimagesink"  
#define VIDEO_DEC "ffdec_mpeg2video"

pipeline = gst_pipeline_new (NULL);  
        g_assert (pipeline);  
         
        rtpsrc = gst_element_factory_make ("udpsrc", "rtpsrc");  
        g_assert (rtpsrc);  
               
        printf("\n Creating rtpbin element ");
        rtpbin = gst_element_factory_make ("gstrtpbin", "rtpbin");  
                                                                                                                                                                                                                                g_object_set (rtpsrc, "port", 51000, NULL);
        printf("\n set caps on the udpsrc for the RTP data \n");
        caps = gst_caps_from_string (VIDEO_CAPS);  
        g_object_set (rtpsrc, "caps", caps, NULL);  
        gst_caps_unref (caps);  
        gst_bin_add_many (GST_BIN (pipeline), rtpsrc, NULL); //Working only
        jitterbuffer = gst_element_factory_make
("gstrtpjitterbuffer","jitterbuffer");
  g_assert (jitterbuffer);

        videodepay = gst_element_factory_make ("rtpmp2tdepay", "videodepay");
        g_assert (videodepay);
       
        GstElement *demux = gst_element_factory_make ("ffdemux_mpegts", NULL);
        g_assert (demux);
       
        videodec = gst_element_factory_make (VIDEO_DEC, "videodec");
        g_assert (videodec);

        videoqueue=gst_element_factory_make ("queue","videoqueue");  
        g_assert(videoqueue);  

        tee = gst_element_factory_make ("tee","tee");  
        g_assert(tee);  

        videoconv = gst_element_factory_make ("ffmpegcolorspace", "videoconv");  
        g_assert (videoconv);  
         
        videosink = gst_element_factory_make (VIDEO_SINK, "videosink");  
        g_assert (videosink);  
       
        GstElement *parse = gst_element_factory_make ("mpegtsparse","parse");
        g_assert(parse);
 
 
  g_object_set (G_OBJECT (videoqueue), "max-size-bytes", 0, NULL);
  g_object_set (G_OBJECT (videoqueue), "max-size-buffers", 0, NULL);
  g_object_set (G_OBJECT (videoqueue), "max-size-time", 500000, NULL);

 gst_bin_add_many (GST_BIN
(pipeline),jitterbuffer,tee,videodepay,demux,videoqueue,videodec,videoconv,videosink,NULL);
       
        if (!gst_element_link(jitterbuffer, tee))
        {
                link_error(jitterbuffer, tee);
                return FALSE;
        }
        else if (!gst_element_link(tee,videodepay))
        {
                link_error(tee,videodepay);
                return FALSE;
        }
        else if (!gst_element_link(videodepay,demux))
        {
                link_error(videodepay,demux);
                return FALSE;
        }
        else if (!gst_element_link(demux, videoqueue))
        {
                link_error(demux, videoqueue);
                return FALSE;
        }
        else if (!gst_element_link(videoqueue,videodec))
        {
          link_error(videoqueue,videodec);
          return FALSE;
        }
        else if (!gst_element_link(videodec,videoconv))
        {
          link_error(videodec,videoconv);
          return FALSE;
        }
        else if (!gst_element_link(videoconv,videosink))
        {
          link_error(videoconv,videosink);
          return FALSE;
        }

gst_bin_add (GST_BIN (pipeline), rtpbin);
        srcpad = gst_element_get_static_pad (rtpsrc, "src");  
        sinkpad = gst_element_get_request_pad (rtpbin, "recv_rtp_sink_%d");  
        lres = gst_pad_link (srcpad, sinkpad);  
        g_assert (lres == GST_PAD_LINK_OK);  
        gst_object_unref (srcpad);  

        g_signal_connect (rtpbin, "pad-added", G_CALLBACK
(pad_added_cb),jitterbuffer);  
 
        g_print ("starting receiver pipeline\n");  
        gst_element_set_state (pipeline, GST_STATE_PLAYING);  

         
        loop = g_main_loop_new (NULL, FALSE);  
        g_main_loop_run (loop);  

        return 0;





--
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: Could not link ffdemux_mpegts0 to videoqueue

rland
Which version of gstreamer ? There is no ffdemux_mpegts in 1.0 and tsdemux is
used instead. -)



--
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: Could not link ffdemux_mpegts0 to videoqueue

gagankumarnigam
This is Rhel-6.5 and gstreamer-0.10 version.
I  also tried it with mpegtsdemux but same condition Error could not link
mpegtsdemux0 with queue.





--
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: Could not link ffdemux_mpegts0 to videoqueue

gagankumarnigam
But removing the mpegtsdemux/ tsdemux /ffdemux_mpeg2ts from the bin_add_many
and gst_element_link makes the code run successfuly with no display creating
new payload on pad: recv_rtp_src_0_3497830


display nothing.........................??


any idea????



--
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: Could not link ffdemux_mpegts0 to videoqueue

Tim Müller
In reply to this post by gagankumarnigam
On Mon, 2018-04-16 at 23:58 -0700, gagankumarnigam wrote:

Hi,

> But when i try to transform the same pipeline in c code i got error :
>  Could not link ffdemux_mpegts0 to videoqueue.
>
> Here is my code given below. Can some body help me out what is the
> problem here.

Demuxers usually also have dynamic pads, so you need to use "pad-added"
here as well and wait for the demuxer to create a video pad.

Cheers
-Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Could not link ffdemux_mpegts0 to videoqueue

gagankumarnigam
Hi Tim,

I also added video pad with demuxer Still same issue could not link
mpegtsdemux0 with queue.
Also replied in previous post if remove mpegtsdemux then code runs and
compile nicely with display nothing.
see my code given below i added pad .


#define VIDEO_CAPS
"application/x-rtp,media=video/mpegts,payload=(int)33,clock-rate=(int)90000,
encoding-name=MP2TS"
#define PORT 51000  
#define VIDEO_SINK  "xvimagesink
#define VIDEO_DEC  "ffdec_mpegvideo
pipeline = gst_pipeline_new (NULL);  
        g_assert (pipeline);
rtpsrc = gst_element_factory_make ("udpsrc", "rtpsrc");  
        g_assert (rtpsrc);
rtpbin = gst_element_factory_make ("gstrtpbin", "rtpbin");  
        g_assert (rtpbin);
g_object_set (rtpsrc, "port", PORT, NULL);
caps = gst_caps_from_string (VIDEO_CAPS);  
        g_object_set (rtpsrc, "caps", caps, NULL);  
        gst_caps_unref (caps);  
gst_bin_add_many (GST_BIN (pipeline), rtpsrc, NULL); //Working only
        jitterbuffer = gst_element_factory_make
("gstrtpjitterbuffer","jitterbuffer");
  g_assert (jitterbuffer);
videodepay = gst_element_factory_make ("rtpmp2tdepay", "videodepay");
GstElement *demux = gst_element_factory_make ("mpegtsdemux", "mpegtsdemux");

        videoqueue=gst_element_factory_make ("queue","videoqueue");  
        g_assert(videoqueue);  
        GstElement *queue = gst_element_factory_make("queue", "q_tee1");
        g_assert(queue);
        tee = gst_element_factory_make ("tee","tee");  
        g_assert(tee);  
        aviqueue=gst_element_factory_make ("queue","aviqueue");  
        g_assert(aviqueue);  
        videoconv = gst_element_factory_make ("ffmpegcolorspace", "videoconv");  
        g_assert (videoconv);    
        videosink = gst_element_factory_make (VIDEO_SINK, "videosink");  
        g_assert (videosink);  

 g_object_set (G_OBJECT (videoqueue), "max-size-bytes", 10000, NULL);
  g_object_set (G_OBJECT (videoqueue), "max-size-buffers", 1000, NULL);
  g_object_set (G_OBJECT (videoqueue), "max-size-time", 500000, NULL);

gst_bin_add_many (GST_BIN
(pipeline),jitterbuffer,videodepay,tee,videoqueue,videodec,videoconv,videosink,NULL);
res1 = gst_element_link_many
(jitterbuffer,videodepay,demux,tee,videoqueue,videodec,videoconv,videosink,
NULL);
g_assert (res1 == TRUE);
g_object_set (G_OBJECT (videosink), "sync" , TRUE ,  NULL);
g_object_set (G_OBJECT (rtpbin),"latency",1000,NULL);  
g_object_set(G_OBJECT (jitterbuffer), "do-lost", true, NULL);  
gst_bin_add (GST_BIN (pipeline), rtpbin);
srcpad = gst_element_get_static_pad (rtpsrc, "src");  
sinkpad = gst_element_get_request_pad (rtpbin, "recv_rtp_sink_%d");  
lres = gst_pad_link (srcpad, sinkpad);  
g_assert (lres == GST_PAD_LINK_OK);  
gst_object_unref (srcpad);
g_signal_connect (rtpbin, "pad-added", G_CALLBACK
(pad_added_cb),jitterbuffer);  
g_print ("starting receiver pipeline\n");  
gst_element_set_state (pipeline, GST_STATE_PLAYING);  
loop = g_main_loop_new (NULL, FALSE);  
g_main_loop_run (loop);  
return 0;

}

static void  pad_added_cb (GstElement * rtpbin, GstPad * new_pad, GstElement
*jitterbuffer)  
{  
        GstPad *sinkpad;  
        GstPadLinkReturn lres;  
        g_print ("new payload on pad: %s\n", GST_PAD_NAME (new_pad));  
  sinkpad = gst_element_get_static_pad (jitterbuffer, "sink");  
        g_assert (sinkpad);  
        lres = gst_pad_link (new_pad, sinkpad);  
        gst_object_unref (sinkpad);
}  



--
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: Could not link ffdemux_mpegts0 to videoqueue

gagankumarnigam
Can any body have any clue for solving the problem for mpegtsdemux  posted
the day before yesterday ??



--
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: Could not link ffdemux_mpegts0 to videoqueue

gagankumarnigam
Tim ,

its too long.
 have any idea ??



--
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: Could not link ffdemux_mpegts0 to videoqueue

gagankumarnigam
Hi tim

Can u plz tell me how to write c code for this pipeline

gst-launch udpsrc port=51000
caps="application/x-rtp,media=video,payload=33,clock-rate=90000,
encoding-name=MP2TS " ! rtpmp2tdepay ! mpegtsdemux ! queue !
ffdec_mpeg2video ! ffmpegcolorspace ! xvimagesink

at least how to link mpegtsdemux to queue

because i am geeting error of linking the above both



--
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: Could not link ffdemux_mpegts0 to videoqueue

Nicolas Dufresne-5
Le samedi 12 mai 2018 à 03:37 -0700, gagankumarnigam a écrit :
> Hi tim
>
> Can u plz tell me how to write c code for this pipeline
>
> gst-launch udpsrc port=51000
> caps="application/x-rtp,media=video,payload=33,clock-rate=90000,
> encoding-name=MP2TS " ! rtpmp2tdepay ! mpegtsdemux ! queue !
> ffdec_mpeg2video ! ffmpegcolorspace ! xvimagesink

if this is gstreamer 0.10, you should seriously move on to a newer
GStreamer. This is series is no longer supported and may have serious
issues.

That being said, try using mpegvideoparse element before or after the
queue.

>
> at least how to link mpegtsdemux to queue
>
> because i am geeting error of linking the above both
>
>
>
> --
> 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: Could not link ffdemux_mpegts0 to videoqueue

gagankumarnigam
Hi ,

I am working on gstreamer-1.10.4. As desired i linked element like this

gst_bin_add_many (GST_BIN (pipeline), udpsrc, NULL);
gst_bin_add_many (GST_BIN
(pipeline),jitterbuffer,rtpmp2tdepay,queue,tsparse,tsdemux,videoqueue,avdec_mpeg2video,videoconv,xvimagesink,NULL);
gst_element_link_many
(jitterbuffer,rtpmp2tdepay,queue,tsparse,tsdemux,videoqueue,avdec_mpeg2video,videoconv,xvimagesink,
NULL);

srcpad = gst_element_get_static_pad (rtpsrc, "src");  
        sinkpad = gst_element_get_request_pad (rtpbin, "recv_rtp_sink_%u");  
        lres = gst_pad_link (srcpad, sinkpad);  
        g_assert (lres == GST_PAD_LINK_OK);  
        gst_object_unref (srcpad);  
g_signal_connect (rtpbin, "pad-added", G_CALLBACK
(pad_added_cb),jitterbuffer);

i always getting error could not link tsdemx0 to videoqueue

Moreover , i want to know how to receive programme-number if we are
streaming mpeg2ts video using v4l2src



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