how to encode yuv files using h.264 encoder?

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

how to encode yuv files using h.264 encoder?

Rafael Sousa-2
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);

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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

sender.c (21K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

how to encode yuv files using h.264 encoder?

rafael.lmsousa
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);

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



------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

sender.c (21K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to encode yuv files using h.264 encoder?

Marco Ballesio
In reply to this post by Rafael Sousa-2
Hi,

sorry for the late reply, I hope this will help

On Mon, Oct 18, 2010 at 11:45 PM, Rafael Sousa <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to encode yuv files using h.264 encoder?

Tim-Philipp Müller-2
On Fri, 2010-10-22 at 23:25 +0300, Marco Ballesio wrote:

> I suggest you to use, if possible, a container format to wrap
> your yuv frames with,

e.g. .y4m files (yuv4mpeg).

> ... 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 ;)!

An easier solution, because you don't need to calculate the size in
bytes yourself, is to use the videoparse element, like this for example:

gst-launch-0.10 filesrc location=foreman_cif.yuv ! videoparse width=352
height=288 format=i420 framerate=25/1 ! ffmpegcolorspace ! ximagesink

(xvimagesink would be even better, but may not always work)

Cheers
 -Tim




------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel