title: C++ FFMPEG not writing AVCC box information
body: <p>I'm trying to encode raw H264 into an mp4 container using the FFMPEG API in C++. It all works fine, however the AVCC box is empty, and it returns the error:
  [iso file] Box "avcC" size 8 invalid</p>
  
  <p>If I then use the command line tool on the output file:</p>
  
  <blockquote>
    <p>ffmpeg -i output.mp4 -vcodec copy fixed.mp4</p>
  </blockquote>
  
  <p>The output file works and AVCC is populated with the required information. I'm at a loss as to why this command line argument works but I'm unable to produce the same result using the API.</p>
  
  <p>What I do in the C++ code (also do things in between the function calls):</p>
  
  <pre><code>outputFormat_ = av_guess_format( "mp4", NULL, NULL ); //AV_CODEC_H264
  formatContext_ = avformat_alloc_context();
  formatContext_-&gt;oformat = outputFormat_;
  ...
  AVDictionary *opts = NULL;
  char tmpstr[50]; sprintf(tmpstr, "%i", muxRate * KILOBYTESTOBYTES);
  av_dict_set(&amp;opts, "muxrate", tmpstr, 0);
  avformat_write_header( formatContext_, &amp;opts);
  av_write_trailer(formatContext_);
  </code></pre>
  
  <p>The output of this is correct, except it's missing the AVCC information. Adding this is manually (and fixing the box lengths accordingly) lets me playback the video fine. Any idea why the API calls are not generating the AVCC info?</p>
  
  <p>For reference, here's the chars from the mp4 before the fix:</p>
  
  <blockquote>
    <p>.avc1.........................€.8.H...H..........................................ÿÿ....avcC....stts</p>
  </blockquote>
  
  <p>and after:</p>
  
  <blockquote>
    <p>avc1.........................€.8.H...H..........................................ÿÿ...!avcC.B€(ÿá..gB€(Ú.à.—•...hÎ&lt;€....stts</p>
  </blockquote>