title: What does it mean "invalid NAL unit size" for h.264 decoder?
body: <p>I want to transmux a .mkv file to .mp4 using Libav but when I try to decode the video h.264 stream there is a malfunction in my code</p>
  
  <blockquote>
    <p>Invalid NAL unit size 21274662>141</p>
    
    <p>Error splitting the input into NAL units</p>
    
    <p>The stream seems to contain AVCC extradata with Annex B formatted data which is invalid.
    no frame!</p>
    
    <p>Could not send paket for decoding ("error invalid data when processing input")</p>
  </blockquote>
  
  <p>A relevant section of code is available below.</p>
  
  <pre><code>while(!(ret = av_read_frame(ifmt_ctx, &amp;input_packet))&amp;&amp;(ret&gt;=0)){
  
           if ((ret = avcodec_send_packet(avctx, &amp;input_packet)) &lt; 0) {
              fprintf(stderr, "Could not send packet for decoding (error '%s')\n",get_error_text(ret));
              return ret;
          }
  
          ret = avcodec_receive_frame(avctx, iframe);
          if (ret == AVERROR(EAGAIN)) {
              goto read_another_frame;
              /* If the end of the input file is reached, stop decoding. */
          } else if (ret == AVERROR_EOF) {
              break;
          } else if (ret &lt; 0) {
              fprintf(stderr, "Could not decode frame (error '%s')\n",get_error_text(ret));
              break;
          }
          // Default case: encode data
           else {
  
          }
  </code></pre>
  
  <p>I use mainly the new API (send / receive packet /frame) and the confusion exists because it seems like h.264 needs a special implementation. I'm looking forward to any idea from where I should start the debugging.</p>