I see, but the function "av_write_frame->mov_write_packet->ff_mov_write_packet->ff_avc_parse_nal_units->ff_avc_find_startcode" find the start code 0x000001, how can i resolve this problem to make it works?<div>
The first 4 bytes in the AVPacket is the size of this NALU, should i replace the first 4 bytes with 0x000001 or 0x00000001? Is that ok?</div><div>Thanks a lot for your help.<br><br><div class="gmail_quote">2012/12/26 Alex Cohn <span dir="ltr"><<a href="mailto:alexcohn@netvision.net.il" target="_blank">alexcohn@netvision.net.il</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Wed, Dec 26, 2012 at 6:35 AM, Brian Chi <<a href="mailto:beyond702@gmail.com">beyond702@gmail.com</a>> wrote:<br>

> Yes, I read all frames, most return value of function "ff_avc_parse_nal_units" is 0.<br>
> i think maybe the problem is about NAL, will the NAL layer of H264 frame be detached in the function "av_read_frame".<br>
> So in the "ff_avc_parse_nal_units", it can't find start code(0x000001), and discard the frame.<br>
<br>
</div>Packets in mp4 are not stored in annex B format, you will never see<br>
0x000001 start codes there. See<br>
<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd757808(v=vs.85).aspx" target="_blank">http://msdn.microsoft.com/en-us/library/windows/desktop/dd757808(v=vs.85).aspx</a><br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Best Regards,<div>Chi</div>
</div>