<div dir="ltr">On Fri, Jun 21, 2013 at 10:07 PM, Andy Shaules <span dir="ltr"><<a href="mailto:bowljoman@gmail.com" target="_blank">bowljoman@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><div><div class="h5">
    <div>On 6/20/2013 4:51 PM, Alex Cohn wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <p dir="ltr">On 20 Jun 2013 11:13, "Dragos Iordache" <<a href="mailto:dragoshiordache@gmail.com" target="_blank">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_****" target="_blank">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" target="_blank">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>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><div class="im"><pre>_______________________________________________
Libav-user mailing list
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a>
</pre>
    </div></blockquote>
    <br>
    <br>
    Yes,<br>
    <br>
    Take the annex-b stream nals,  typically
    sps,pps,idr,slice,slice......<br>
    <br>
    extract the sps and pps from the stream and create the flv avc
    config packet. For the rest of the frames, the idr and slices. Swap
    the marker bytes for size values, pre-pend pts offset and then wrap
    with the AMF flv audio block header. <br>
    <br>
    I often refer to this java class which transcodes annex-b into AMF
    flash live streams for the red5 server. <br>
    <br>
<a href="http://code.google.com/p/comserver/source/browse/trunk/plugins/shoutcast/src/org/red5/server/plugin/shoutcast/marshal/transpose/VideoFramer.java#421" target="_blank">http://code.google.com/p/comserver/source/browse/trunk/plugins/shoutcast/src/org/red5/server/plugin/shoutcast/marshal/transpose/VideoFramer.java#421</a><br>


    <br>
    Although the raw frame parsing code is old, the beef of the critical
    packets and format of the AMF payload is still valid.<br>
    <br>
    If writing a file, those AMF packets will need to be wrapped with
    the FLV context tag header and trailing size marker, but for rtmp
    they are ready to fly..  <br>
    <br>
    <br>
    <br>
  </div>

<br>_______________________________________________<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>
<br></blockquote></div><br>Thanks. </div><div class="gmail_extra"><br></div><div class="gmail_extra" style>Alex and Carl you helped me a lot and now my app streams like a charm. Great help guys.</div><div class="gmail_extra" style>

<br></div><div class="gmail_extra" style>Now that everything starts to take a shape I will share my project with all of you.</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>It is called Colosseo. And you can check it over here <a href="http://colosseoapp.com">colosseoapp.com</a></div>

<div class="gmail_extra" style><br></div><div class="gmail_extra" style>Thanks again,</div><div class="gmail_extra" style>Dragos</div><div class="gmail_extra"><div><br></div>-- <br><br><a href="mailto:dragoshiordache@gmail.com" target="_blank">dragoshiordache@gmail.com</a><br>

0726736376
</div></div>