Thank you very much sir!<div>I solved my problems according to your suggestion!</div><div><br></div><div>While I have to point out that:</div><div>1. for the four bytes header, it is automatically added if we set <font face="'courier new', monospace"><b>param.b_annexb = 1</b>, </font><font face="arial, helvetica, sans-serif">and 0 while add the size of frame, so we don't need to add it manually. (Don't forget to set </font><b><font face="'courier new', monospace">param.b_repeat_headers = 1</font></b><span style="font-family:arial,helvetica,sans-serif"> )</span></div>

<div>2. after calling x264_encoder_encode, we don't need to call x264_nal_encode, because it is already done inside of the function x264_encoder_encode. (<a href="http://doom10.org/index.php?topic=1820.0">http://doom10.org/index.php?topic=1820.0</a>)</div>

<div><br>Thank you all again! </div><div>Sincerely,</div><div>Yinxia</div><div><br><div class="gmail_quote">2012/3/24 Việt Hùng Nguyễn <span dir="ltr"><<a href="mailto:hungtrodt5@gmail.com">hungtrodt5@gmail.com</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br><br>It seems you got some mistakes in your code.<br>1- In your conversion colour space code, not all stride is frameWidth. For YUV420p, stride for Cr, Cb is frameWidth/2<br>

2- After you call x264_encoder_encode, you should call x264_nal_encode<br>

3- When send data to ffmpeg h264 decoder, remember that is annex-B data stream<br><br></blockquote></div></div>