A problem in playing a streamed H264 video over a network

Tim-Philipp Müller t.i.m at zen.co.uk
Tue Sep 27 01:56:28 PDT 2011


On Mon, 2011-09-26 at 22:47 +0100, ibrahim suliman wrote:

Hi,

> gst-launch udpsrc caps = "video/x-h264, width=(int)176,
> height=(int)144, framerate=(fraction)15/1,
> codec_data=(buffer)014d401effe10018674d401e92540501ed8088000003000800000301e078b17501000468ee3c80, stream-format=(string)avc" multicast-group=127.0.0.1 port=8991 ! h264parse ! ffdec_h264 ! ffmpegcolorspace ! autovideosink
> 
> It is working perfectly using the "gst-launch", but when I implement
> it in a C application, it did not working for me and let me descibe
> what I am thinking is the problem:
> the "caps" property should be included for the "udpsrc" element in
> order to get the H.264 video displayed. This "caps" property has
> different parameters as follows:
>  
> filtercaps = gst_caps_new_simple ("video/x-h264",
>   "width", G_TYPE_INT, 176,
>   "height", G_TYPE_INT, 144,
>   "framerate", GST_TYPE_FRACTION, 15, 1,          
> "codec_data", ........!!!!!!!!!!,
> 014d401effe10018674d401e92540501ed8088000003000800000301e078b17501000468ee3c80,
> "stream-format", G_TYPE_STRING, "avc",
> NULL); 
>  
> as you can see, the problem is that "codec_data" should be of type
> (buffer) and I am not sure how to deal with this type of value. So,
> please help in this....

So first of all your e-mail subject is slightly misleading. Your actual
problem is about how to put a buffer into caps. You could do something
like this:

 const guint8 codec_data[] = { 0x01, 0x4d, .... };
 GstBuffer *buf;
 guint size;

 size = sizeof (codec_data);
 buf = gst_buffer_new_and_alloc (size);
 memcpy (GST_BUFFER_DATA (buf), codec_data, size);
 gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, buf, NULL);
 gst_buffer_unref (buf);

I'm sure you can find more code examples if you grep the GStreamer
plugin source code modules for "codec_data".

Cheers
 -Tim




More information about the gstreamer-devel mailing list