<div dir="ltr"><div><div><div>Hi,<br><br></div>I am trying to convert the following gst-launch command into c:<br><br><b>gst-launch rtspsrc location=rtsp://ipaddress:port name=demux demux. !
queue ! decodebin ! autovideosink demux. ! queue ! rtppcmudepay !
autoaudiosink<br><br></b></div><div>I tried the above command it is able to stream both audio and video.<b><br></b></div><div><br></div>And I played this rtspurl in vlc media player it is showing the properties are as follows:<br><p>Type: Video Codec: H264 - MPEG-4 AVC (part 10) (h264) Resolution: 320x180 Decoded format: Planar 4:2:0 YUV</p>
<p>Type: Audio Codec: PCM MU-LAW (mlaw) Channels: Mono Sample rate: 8000 Hz Bits per sample: 8</p><b>I am converting the above gst-launch command in c in brief explained below</b><br><br> pipeline = gst_pipeline_new("nice_pipeline");<br> source = gst_element_factory_make("nicesrc","source");//thsi source will take the stream from rtsp url<br><b> demuxer = gst_element_factory_make ("avidemux", "avi-demuxer");</b><br> decvd= gst_element_factory_make ("decodebin", "decodebin");<br> vdsink = gst_element_factory_make ("autovideosink", "video-sink");<br> vdqueue = gst_element_factory_make ("queue", "video-queue");<br> adqueue = gst_element_factory_make ("queue", "audio-queue");<br> decad= gst_element_factory_make ("rtppcmudepay", "rtppcmudepay");<br> adsink = gst_element_factory_make ("autoaudiosink", "audio-sink");<br><br> bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));<br> gst_bus_add_watch(bus, bus_call, NULL);<br> gst_object_unref (bus);<br> gst_bin_add_many(GST_BIN (pipeline), source,decvd,decad, adqueue, vdqueue, vdsink, adsink, NULL);<br><br> gst_element_link (source, demuxer);<br> gst_element_link (decvd, vdqueue);<br> gst_element_link (vdqueue, vdsink);<br> gst_element_link (decad, adqueue);<br> gst_element_link (adqueue, adsink);<br><br> g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), NULL);<br> gst_element_set_state(pipeline, GST_STATE_PLAYING);<br><br></div><b>on_pad_added func defintion:</b><br><br>GstCaps *caps;<br> GstStructure *str;<br><br> caps = gst_pad_get_caps (pad);<br> g_assert (caps != NULL);<br> str = gst_caps_get_structure (caps, 0);<br> g_assert (str != NULL);<br><br> if (g_strrstr (gst_structure_get_name (str), "video")) {<br> g_debug ("Linking video pad to dec_vd");<br><br> GstPad *targetsink = gst_element_get_pad (decvd, "sink");<br> g_assert (targetsink != NULL);<br> gst_pad_link (pad, targetsink);<br> gst_object_unref (targetsink);<br> }<br><br> if (g_strrstr (gst_structure_get_name (str), "audio")) {<br> g_debug ("Linking audio pad to dec_ad");<br><br> GstPad *targetsink = gst_element_get_pad (decad, "sink");<br> g_assert (targetsink != NULL);<br> gst_pad_link (pad, targetsink);<br> gst_object_unref (targetsink);<br> }<br><br> gst_caps_unref (caps);<br><br><div><div><div>My question is that what type of demuxer i have to select for the properties of video and audio it is streaming.<br></div><div><br></div><div>If any other solution is there for demuxing audio and video from rtsp url please suggest or provide some sample code for that.<br><br></div><div>Thanks.<br></div></div></div></div>