[gst-devel] how to encode yuv files using h.264 encoder?

Marco Ballesio gibrovacco at gmail.com
Fri Oct 22 22:25:11 CEST 2010


Hi,

sorry for the late reply, I hope this will help

On Mon, Oct 18, 2010 at 11:45 PM, Rafael Sousa <rafaelsousa007 at gmail.com>wrote:

> Hi all,
>
> I'm new in this list and I need to encode a YUV file using H.264 encoder
> for streaming the video in a wireless network. a set up the video source
> using
>
> GstElement *filesrc
> filesrc = gst_element_factory_make("filesrc", "my_filesource");
> g_object_set (G_OBJECT (filesrc), "location", "foreman_cif.yuv", NULL);
>

I suggest you to use, if possible, a container format to wrap your yuv
frames with, btw when dealing with raw data, you need to give it some
context, usually through a parser element. In case of uncompressed video,
you don't even need that, but just some basilar algebra..

Basically, once you know the source resolution, you should compute the frame
size with something like w x h x bpp (3/2 for yuv420, 2 for yuv422 and
similar), then use caps of the like of the following between source and
encoder:

"video/x-raw-yuv, width=w, height=h, framerate=(fraction)n/d"

d and n are denomiator and numerator for the target frame rate (e.g. 1/30).
And don't forget to set the buffer-size of your filesrc to the value you
computed above for the frame size ;)!

Regards


>
> The execution of the complete code works, except for the error to encoder.
>
> Error: Encode x264 frame failed.
>
> Can someone help me with some example on how I can make this work? the
> complete code is in annex.
>
> thanks a lot
>
> --
> Rafael Leite Moraes de Sousa
> Programa de Pós-graduação em Informática - UFAM
>
>
> ------------------------------------------------------------------------------
> Download new Adobe(R) Flash(R) Builder(TM) 4
> The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
> Flex(R) Builder(TM)) enable the development of rich applications that run
> across multiple browsers and platforms. Download your free trials today!
> http://p.sf.net/sfu/adobe-dev2dev
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20101022/f59a12f6/attachment.htm>


More information about the gstreamer-devel mailing list