<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">El 27/01/17 a las 11:14, films
      escribió:<br>
    </div>
    <blockquote
      cite="mid:1464988473.24351508.1485526462766@mail.yahoo.com"
      type="cite">
      <div style="color:#000; background-color:#fff;
        font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
        Lucida Grande, Sans-Serif;font-size:10px">
        <div style="margin-top: 0px; margin-bottom: 0px; font-size:
          12px; line-height: normal; font-family: Helvetica;"
          id="yui_3_16_0_ym19_1_1485526183467_2806">Hi Folks.</div>
        <div style="margin-top: 0px; margin-bottom: 0px; font-size:
          12px; line-height: normal; font-family: Helvetica; min-height:
          14px;" id="yui_3_16_0_ym19_1_1485526183467_2807"><br
            id="yui_3_16_0_ym19_1_1485526183467_2808">
        </div>
        <div style="margin-top: 0px; margin-bottom: 0px; font-size:
          12px; line-height: normal; font-family: Helvetica;"
          id="yui_3_16_0_ym19_1_1485526183467_2809">I am trying to write
          .mp4 files with H.264 and AAC from generated images and audio.
          My app is linked to libAVFormat, libAVCodec etc plus some
          necessary OSX frameworks</div>
        <div style="margin-top: 0px; margin-bottom: 0px; font-size:
          12px; line-height: normal; font-family: Helvetica; min-height:
          14px;" id="yui_3_16_0_ym19_1_1485526183467_2810"><br
            id="yui_3_16_0_ym19_1_1485526183467_2811">
        </div>
        <div style="margin-top: 0px; margin-bottom: 0px; font-size:
          12px; line-height: normal; font-family: Helvetica;"
          id="yui_3_16_0_ym19_1_1485526183467_2812">If I let libAVFormat
          select the codecs for a file named xxxxx.mp4 using
          av_guess_format() it selects the MPEG4 and AAC encoders and
          everything is working **fine**</div>
        <div style="margin-top: 0px; margin-bottom: 0px; font-size:
          12px; line-height: normal; font-family: Helvetica; min-height:
          14px;" id="yui_3_16_0_ym19_1_1485526183467_2813"><br
            id="yui_3_16_0_ym19_1_1485526183467_2814">
        </div>
        <div style="margin-top: 0px; margin-bottom: 0px; font-size:
          12px; line-height: normal; font-family: Helvetica;"
          id="yui_3_16_0_ym19_1_1485526183467_2815">However, I really
          need to use the H.264 codec instead of the MPEG4 video codec,
          so I have tried overriding the guessed codec by simply adding
          this after the av_guess_format stage.</div>
        <div style="margin-top: 0px; margin-bottom: 0px; font-size:
          12px; line-height: normal; font-family: Helvetica; min-height:
          14px;" id="yui_3_16_0_ym19_1_1485526183467_2816"><br
            id="yui_3_16_0_ym19_1_1485526183467_2817">
        </div>
        <div style="margin-top: 0px; margin-bottom: 0px; font-size:
          12px; line-height: normal; font-family: Helvetica;"
          id="yui_3_16_0_ym19_1_1485526183467_2818">fmt->video_codec
          = AV_CODEC_ID_H264;</div>
        <br>
      </div>
    </blockquote>
    I don't have any MacOSX experience, but if you specify the codec,
    you don't need to call av_guess_format.  Here's a sample of my code:<br>
    <br>
    <br>
    <br>
       static AVFormatContext *oc = NULL;<br>
    <br>
    ...<br>
    <br>
       int err = avformat_alloc_output_context2(&oc, NULL, NULL,
    filename);<br>
       if (!oc || err < 0) {<br>
           LOG_WARNING( _("Could not deduce output format from file
    extension: using MPEG.") );<br>
    <br>
          err = avformat_alloc_output_context2(&oc, NULL, "mpeg",
    filename);<br>
          if ( err < 0 )<br>
          {<br>
         LOG_ERROR( _("Could not open mpeg movie") );<br>
         return false;<br>
          }<br>
       }<br>
     <br>
       oc->flags |= AVFMT_FLAG_NOBUFFER|AVFMT_FLAG_FLUSH_PACKETS;<br>
       oc->max_interleave_delta = 1;<br>
    <br>
       fmt = oc->oformat;<br>
       assert( fmt != NULL );<br>
    <br>
      fmt->video_codec = AV_CODEC_ID_H264;<br>
    <pre class="moz-signature" cols="72">-- 
Gonzalo Garramuño</pre>
  </body>
</html>