<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="chsdate"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:NSimSun;
        panose-1:2 1 6 9 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:NSimSun;
        panose-1:2 1 6 9 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0pt;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:SimSun;
        color:blue;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=ZH-CN link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=blue face=宋体><span
lang=EN-US style='font-size:10.5pt;font-family:SimSun;color:blue'>Could you
please let me know the value of </span></font><font size=1 face=新宋体><span
lang=EN-US style='font-size:9.0pt;font-family:NSimSun'>h->frames.i_delay </span></font><font
size=2 color=blue face=宋体><span lang=EN-US style='font-size:10.5pt;
font-family:SimSun;color:blue'>when program enters into </span></font><span
lang=EN-US>x264_encoder_encode </span><font size=2 color=blue face=宋体><span
lang=EN-US style='font-size:10.5pt;font-family:SimSun;color:blue'>routine</span></font><span
lang=EN-US>?</span><font size=2 color=blue face=宋体><span
lang=EN-US style='font-size:10.5pt;font-family:SimSun;color:blue'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=blue face=宋体><span
lang=EN-US style='font-size:10.5pt;font-family:SimSun;color:blue'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=宋体><span
style='font-size:10.0pt;font-family:SimSun;font-weight:bold'>发件人<span
lang=EN-US>:</span></span></font></b><font size=2 face=宋体><span
lang=EN-US style='font-size:10.0pt;font-family:SimSun'>
x264-devel-bounces@videolan.org [mailto:x264-devel-bounces@videolan.org] </span></font><b><font
size=2 face=宋体><span style='font-size:10.0pt;font-family:SimSun;
font-weight:bold'>代表 </span></font></b><font size=2 face=宋体><span
lang=EN-US style='font-size:10.0pt;font-family:SimSun'>Alessandro Ferrari<br>
</span></font><b><font size=2 face=宋体><span style='font-size:
10.0pt;font-family:SimSun;font-weight:bold'>发送时间<span
lang=EN-US>:</span></span></font></b><font size=2 face=宋体><span
lang=EN-US style='font-size:10.0pt;font-family:SimSun'> <st1:chsdate
IsROCDate="False" IsLunarDate="False" Day="25" Month="8" Year="2009" w:st="on">2009<span
lang=EN-US><span lang=EN-US>年8</span></span><span lang=EN-US><span
lang=EN-US>月25</span></span><span lang=EN-US><span lang=EN-US>日</span></span></st1:chsdate></span></font><font
size=2 face=宋体><span style='font-size:10.0pt;font-family:SimSun'>
<span lang=EN-US>17:58<br>
</span><b><span style='font-weight:bold'>收件人<span
lang=EN-US>:</span></span></b><span lang=EN-US> x264-devel@videolan.org<br>
</span><b><span style='font-weight:bold'>主题<span lang=EN-US>:</span></span></b><span
lang=EN-US> [x264-devel] Problem on using x264_encoder_encode</span></span></font><span
lang=EN-US><o:p></o:p></span></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>Hi dear community,<br>
I have a problem with the encoding using x264. After I call x264_encoder_encode(
h, &nal, &i_nal, pic, &pic_out) function I have nal= NULL,
i_nal=0 and the function return 0. I'm sure that pic contain the correct image.
The x264_t h is open using the default parameters, i only change width and
length of the video. The function don't give me any error, it seems that it not
encode any data. I include the code of encoding function that I implement
watching x264.c.<br>
<br>
void MyFunction()<br>
{<br>
x264_param_t param;<br>
x264_t *h;<br>
x264_picture_t pic;<br>
<br>
//Set the default parameters<br>
x264_param_default( &param );<br>
<br>
//Video settings<br>
param->i_width = WIDTH;<br>
param->i_height = HEIGHT;<br>
<br>
//Open the encoder<br>
if( ( h = x264_encoder_open( &param ) ) == NULL )<br>
{<br>
fprintf( stderr, "x264
[error]: x264_encoder_open failed\n" );<br>
return -1;<br>
}<br>
<br>
/* Create a new pic */<br>
x264_picture_alloc( &pic, X264_CSP_I420, param.i_width,
param.i_height );<br>
<br>
//Launch the encode routine <br>
Encode_frame( h , &pic );<br>
<br>
//Release resoirce<br>
x264_picture_clean( &pic );<br>
x264_encoder_close(h);<br>
}<br>
<br>
int Encode_frame( x264_t *h , x264_picture_t *pic)<br>
{<br>
x264_nal_t *nal;<br>
int i_nal, i;<br>
x264_picture_t pic_out;<br>
static int mux_buffer_size = 0;<br>
uint8_t *mux_buffer = NULL;<br>
int size;<br>
<br>
//Set YUV420<br>
pic->img.i_csp = X264_CSP_I420;<br>
pic->img.i_plane = 3;<br>
<br>
//I take the YUV image from a
decoded image decode with ffmpeg<br>
if (picture) {<br>
for(i = 0; i <
3; i++){<br>
pic->img.plane[i] = picture->data[i];<br>
pic->img.i_stride[i] = picture->linesize[i];<br>
}<br>
<br>
pic->i_pts =
picture->pts;<br>
pic->i_type =
X264_TYPE_AUTO;<br>
}<br>
<br>
//pic contains the correct image. <br>
if( (i = x264_encoder_encode( h,
&nal, &i_nal, pic, &pic_out)) <0)<br>
return
-1; <br>
<br>
/*<br>
* In this point nal is
null, i_nal is 0. There isn't any error message in the routine.<br>
* As consequence the
next loop don't execute any step.<br>
*/ <br>
<br>
<br>
//packetize the encoded information
in nal unit<br>
for( i = 0; i < i_nal; i++ )<br>
{<br>
int i_size;<br>
<br>
printf("\nNal unit n° %d",i);<br>
<br>
if(
mux_buffer_size < nal[i].i_payload * 3/2 + 4 )<br>
{<br>
mux_buffer_size = nal[i].i_payload * 2 +
4;<br>
free( (void*) mux_buffer );<br>
mux_buffer = (uint8_t*) malloc(
mux_buffer_size );<br>
}<br>
<br>
size = size +
mux_buffer_size;<br>
i_size =
mux_buffer_size;<br>
x264_nal_encode(
mux_buffer, &i_size, 1, &nal[i] );<br>
write_nal_unit(
mux_buffer , i_size ,"outframe.mpeg4" );<br>
}<br>
<br>
return size;<br>
}<br>
<br>
I'm excuse in advance. I'm not sure that is the correct mailing list (if not is
very appreciated if suggest me what mailing list is the right).<br>
Many thanks. <o:p></o:p></span></font></p>
</div>
</body>
</html>