<p dir="ltr">On 20 Jun 2013 11:13, "Dragos Iordache" <<a href="mailto:dragoshiordache@gmail.com">dragoshiordache@gmail.com</a>> wrote:<br>
><br>
> Hi again,<br>
><br>
> So I tested some more and the stream works ok with .\ffmpeg.exe -i .\test.h264 -c:v copy -f  flv rtmp://<a href="http://live.justin.tv/app/live_****">live.justin.tv/app/live_****</a><br>
> But the stream does not work with my implementation using libffmpeg.<br>
><br>
> I tried different methods for sending the stream with libffmpeg but none worked ok. What I do now:<br>
><br>
> -create an oformat of flv<br>
> -create a context for flv and filename=rtmp:/...<br>
> -initialize a stream of h264 codec<br>
> -write header<br>
> -encode using stagefright<br>
> -create a packet<br>
> -write the packet<br>
><br>
> The test.h264 in the ffmpeg line is created using this method and filename is set to "test.h264" and not a rtmp server, so I think this is ok.<br>
><br>
> The captured frame data differs slightly between the command I run with ffmpeg and my code using libffmpeg. One of the diferences if that the NAL header "00 00 00 01" is not like this in the ffmpeg method.</p>

<p dir="ltr">Absolutely. FLV uses the AVCC format to store h264 NALUs. See for example an excellent explanation at <a href="http://livertmpjavapublisher.blogspot.co.il/2011/06/h264-avcvideopacket.html">http://livertmpjavapublisher.blogspot.co.il/2011/06/h264-avcvideopacket.html</a>.</p>

<p dir="ltr">> What do you think is not right?</p>
<p dir="ltr">Stagefright encoder produces packets in annex-b format. It could be enough to change their headers to AVCC format to make your rtmp happy.</p>
<p dir="ltr">> Thanks for your help. <br>
><br>
> Dragos</p>
<p dir="ltr">Regards,<br>
Alex</p>