[Libav-user] H264+flv bad video stream

Alex Cohn alexcohn at netvision.net.il
Fri Jun 21 01:51:26 CEST 2013

On 20 Jun 2013 11:13, "Dragos Iordache" <dragoshiordache at gmail.com> wrote:
> Hi again,
> So I tested some more and the stream works ok with .\ffmpeg.exe -i
.\test.h264 -c:v copy -f  flv rtmp://live.justin.tv/app/live_****
> But the stream does not work with my implementation using libffmpeg.
> I tried different methods for sending the stream with libffmpeg but none
worked ok. What I do now:
> -create an oformat of flv
> -create a context for flv and filename=rtmp:/...
> -initialize a stream of h264 codec
> -write header
> -encode using stagefright
> -create a packet
> -write the packet
> 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.
> 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.

Absolutely. FLV uses the AVCC format to store h264 NALUs. See for example
an excellent explanation at

> What do you think is not right?

Stagefright encoder produces packets in annex-b format. It could be enough
to change their headers to AVCC format to make your rtmp happy.

> Thanks for your help.
> Dragos

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130621/520cbb07/attachment.html>

More information about the Libav-user mailing list