<div dir="ltr">Also - av_parser_parse2 doesnt seem to like out of order NAL packets - is this also a known issue?<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 10, 2013 at 3:43 PM, Faraz Khan <span dir="ltr"><<a href="mailto:faraz@screenhero.com" target="_blank">faraz@screenhero.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">So I got the decoder to work with the parser! It was a bug on my end - However it still seems that the parser waits for the entire frame to complete and then sets an outsize? Is this intentional? Is it possible to decode a single NALU?<div>

<br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 10, 2013 at 2:57 PM, Faraz Khan <span dir="ltr"><<a href="mailto:faraz@screenhero.com" target="_blank">faraz@screenhero.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">So the keyframe cannot be fed to the decoder one nal at a time? Is that what you are suggesting?<div><br>

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


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>I always had to decode from the latest
      key frame up to the desired stream time nal,<div><div><br>
      <br>
      On 6/10/2013 2:36 PM, Faraz Khan wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div>
      <div dir="ltr">Hi all,
        <div>I'm trying to use ffmpeg as a decoder for a real-time x264
          stream that I'm generating. It works fine if I try to decode
          entire frames, but if I try to decode a single NALU the
          decoder errors out saying 'no frame'. I've tried using the
          parser (av_parser_parse2) but the h264 decoder doesnt seem to
          like that output either. I'm using x264 with annex-b and
          repeat-headers on. </div>
        <div><br>
        </div>
        <div>The encoder config is as follows:<br>
          <br>
          x264params.b_sliced_threads = 1;<br>
          x264params.i_slice_max_size = 1350;<br>
          x264params.i_width = yuvSize.width;<br>
          x264params.i_height = yuvSize.height;<br>
          x264params.i_fps_num = 10;<br>
          x264params.i_fps_den = 1;<br>
          x264params.b_vfr_input = 0;<br>
          x264params.rc.i_bitrate = 1500;<br>
          <br>
        </div>
        <div> // Intra refres:<br>
          x264params.i_keyint_max = 50000000;<br>
          x264params.b_intra_refresh = 1;<br>
          <br>
        </div>
        <div>//Rate control:<br>
          <br>
          x264params.rc.i_rc_method = X264_RC_ABR;<br>
          x264params.rc.i_vbv_buffer_size = 300;<br>
          x264params.rc.i_vbv_max_bitrate = 1500;<br>
          <br>
        </div>
        <div>//For streaming:<br>
          x264params.b_repeat_headers = 1;<br>
          x264params.b_annexb = 1;<br>
          <br>
        </div>
        <div>x264_param_apply_profile(&x264params, "baseline");</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>I do the encode with:</div>
        <div>
          <p>    <span>int</span> frame_size = <span>x264_encoder_encode</span>(<span>x264Encoder</span>,
            &nals, &i_nals, &<span>pic_in</span>,
            &<span>pic_out</span>);</p>
          <p><br>
          </p>
          <p>Now, since the max slice size is 1350, each packet
            output is a udp packet of size < MTU (this is true) and
            sent across the network.<br>
          </p>
          <p>I iterate over the nals[i].p_payload and
            send them over to the ffmpeg side for decoding. I receive
            the correct packet on the remote side. </p>
          <p>If I assemble ALL the NALUs that were
            output in this frame and feed it directly to the decoder
            (even without the parser), it works fine! If I feed one NALU
            at a time, it fails (event with the parse). I'm sending it
            to the parser like:<br>
          </p>
          <p><br>
          </p>
          <p>int plen = av_parser_parse2(codecParser,
            decoderContext, &outbuf, &outside,
            indata,inlength,0,0,0);</p>
          <p><br>
          </p>
          <p>plen always reports that it consumed the
            entire NALU that I gave it - after consuming a few NALUs,
            the outsize and outbuf are set to some value. Feeding it
            into the decoder using:</p>
          <p><br>
          </p>
          <p> int len =
            avcodec_decode_video2(decoderContext,decoderOutframe,
            &gotpic,&avpkt);</p>
          <p><br>
          </p>
          <p>Results in it saying 'No frame'. Again,
            if avpkt.data contains the entire frame (all NALUs
            concatenated) it will work! </p>
          <p><br>
          </p>
          <p>I'm obviously doing some obviously wrong
            - but I really cant figure out why it wont decode a single
            NALU. Or is this a limitation in ffmpeg?</p>
          <p><br>
          </p>
          <p>
            Thanks Guys!</p>
          <p><br>
          </p>
          <p><br>
          </p>
        </div>
        <div>
          <div dir="ltr"><br>
            <div>--</div>
            <div>Faraz Khan</div>
            <div>Simple Collaboration Screensharing</div>
            <div><a href="http://www.screenhero.com" target="_blank">www.screenhero.com</a></div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><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>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">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><br clear="all"><div><br></div></div></div>-- <br><div><div dir="ltr"><br><div>--</div><div>Faraz Khan</div><div>Simple Collaboration Screensharing</div><div><a href="http://www.screenhero.com" target="_blank">www.screenhero.com</a></div>


</div>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><br><div>--</div><div>Faraz Khan</div><div>Simple Collaboration Screensharing</div><div><a href="http://www.screenhero.com" target="_blank">www.screenhero.com</a></div>

</div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><br><div>--</div><div>Faraz Khan</div><div>Simple Collaboration Screensharing</div><div><a href="http://www.screenhero.com" target="_blank">www.screenhero.com</a></div>
</div>
</div>