<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi all, I had a command line code to record video from network and it was working fine (it is listed below):<br>gst-launch udpsrc port=5000 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H263-1998" num-buffers=5000 ! queue ! rtph263pdepay ! 'video/x-h263,width=320,height=240,framerate=(fraction)25/1' ! queue ! avimux ! queue ! filesink location=test1.avi<br><br>So, I wanted to change this into a code so that I wanted to include it in my application and I failed. Please help me. I got an error on the gst_bin_add_many and gst_element_link_many functions. The code is presented below. Please help me. The error is the following:<br><br>(videorecorder:19632): GStreamer-CRITICAL **: gst_bin_add: assertion `GST_IS_ELEMENT (element)' failed<br>(videorecorder:19632): GStreamer-CRITICAL **: gst_element_link_pads_filtered: assertion `GST_IS_ELEMENT (dest)' failed<br><br>Thank you.<br><br>- Zelalem S. <br><br>#include &lt;gst/gst.h&gt;<br>#include &lt;stdio.h&gt;<br><br>int<br>main (int&nbsp;&nbsp; argc,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char *argv[])<br>{<br><br>&nbsp; GstElement *udpsource, *queue1, *queue2, *queue3, *h263depay, *avimuxer, *filedes, *pipeline;<br>&nbsp; GstCaps *caps, *caps2;<br>&nbsp; /* init GStreamer */<br>&nbsp; gst_init (&amp;argc, &amp;argv);<br>&nbsp; /* create element */<br><br>&nbsp; udpsource = gst_element_factory_make ("udpsrc", "udpsource");<br><br>&nbsp; queue1 = gst_element_factory_make ("queue", "queue1");&nbsp; <br>&nbsp; queue2 = gst_element_factory_make ("queue", "queue2");&nbsp; <br><br>//&nbsp; queue3 = gst_element_factory_make ("queue", "queue3");&nbsp; <br><br>&nbsp; h263depay = gst_element_factory_make ("rtph263pdepay", "h263depay");&nbsp; <br>&nbsp; avimuxer = gst_element_factory_make ("avimux", "avimuxer");&nbsp; <br>&nbsp; filedes = gst_element_factory_make ("filesink", "filedes");&nbsp; <br><br><br>&nbsp; caps = gst_caps_new_simple( "application/x-rtp", "media", G_TYPE_STRING, "video", "clock-rate",<br>&nbsp; G_TYPE_INT, 90000, "encoding-name", G_TYPE_STRING, "H263-1998", "num-buffers",G_TYPE_INT,5000,NULL);<br>&nbsp; caps2 = gst_caps_new_simple ("video/x-h263", "width", G_TYPE_INT, 320, "height", G_TYPE_INT, 240, <br>&nbsp; "framerate", GST_TYPE_FRACTION, 25, 1, NULL);<br><br>//&nbsp; g_object_set (G_OBJECT (udpsource), "port", 5000, NULL);<br>&nbsp; g_object_set (G_OBJECT (udpsource), "port", 5000, "caps", caps, NULL);<br>&nbsp; g_object_set (G_OBJECT (filedes), "location", "test20.avi", NULL);<br><br>//&nbsp; caps2 = gst_caps_new_simple("video/x-h263","width", 320, "height", 240, "framerate", 25, 1,NULL) ;<br>/* alternative */<br><br>&nbsp;<br>&nbsp;pipeline = gst_pipeline_new ("video-pipeline");<br><br>if (!pipeline || !udpsource || !queue1 || !queue2 || !h263depay || !avimuxer || !filedes || !caps || !caps2) {<br>&nbsp; g_printerr ("One of the element could not be created. Exiting.\n");<br>&nbsp; return -1;<br>}<br><br>//add elements to the pipeline<br>gst_bin_add_many (GST_BIN (pipeline),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; udpsource, queue1, h263depay, caps2, avimuxer, queue2, filedes, NULL);<br><br><br>//link the elements<br>//gst_element_link_many (udpsource, queue1, h263depay, NULL);<br>//gst_element_link_many (avimuxer, queue2, filedes, NULL);<br><br>gst_element_link_many(udpsource, queue1, h263depay,caps2,avimuxer, queue2, filedes, NULL);<br><br>//link two elements with a filter (here h263depay and queue2 with caps2<br>//gboolean link_ok = gst_element_link_filtered (h263depay, avimuxer, caps2);<br><br>//start the pipeline<br>gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);<br><br><br>&nbsp; gst_object_unref (GST_OBJECT (pipeline));<br>&nbsp; return 0;<br>}<br><br /><hr />Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! <a href='http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us' target='_new'>Try it!</a></body>
</html>