<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>Thanks this seems to solve problem. I didn't find this discussion
      with search engine. Nice explanation why number 512.<br>
    </p>
    <p>Ok I was assuming this was problem as I faced this with writing
      audio but when I debugged with ffmpeg.c this problem and it didn't
      set packet.duration and neither did transcoding.c but I assume
      it's been set just before writing to disk.</p>
    <p>I update transcoding.c and try to make PR with it so nobody else
      shouldn't back head against wall with this.</p>
    <p>Sincerely,</p>
    <p>Tuukka<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Vassilis kirjoitti 11.7.2020 klo 19.25:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAGcmhj5VAdhJzy1PFtkdnkqEPeaq6GKCjMcz8RTe=MJjEnTX6Q@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hello,
        <div><br>
        </div>
        <div>
          <div>This seems like an issue I faced with my own attempt at
            transcoding video and a fix was suggested by a member of
            this mailing list (thanks James). You need to set the
            AVPacket duration field, otherwise this issue is present.
            This would mean adding something in the lines of the
            following line of code before your
            av_interleaved_write_frame is called:</div>
          <div>
            <div><br>
            </div>
            <div>// for example, if 25 FPS, and time_base is 12800, then
              packet.duration = 12800 / 25 = 512<br>
            </div>
            <div>output_packet.duration =
              format_context->streams[stream_index]->time_base.den
              /
              format_context->streams[stream_index]->time_base.num
              /
              format_context->streams[stream_index]->avg_frame_rate.num
              *
              format_context->streams[stream_index]->avg_frame_rate.den;<br>
            </div>
            <div><br>
            </div>
            <div> /* mux encoded frame */<br>
                  ret = av_interleaved_write_frame(format_context,
              output_packet);<br>
            </div>
            <div><br>
            </div>
            <div>Hope this helps!</div>
          </div>
        </div>
        <div>Vas</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, Jul 10, 2020 at 9:19
          PM Tuukka Pasanen <<a
            href="mailto:pasanen.tuukka@gmail.com"
            moz-do-not-send="true">pasanen.tuukka@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
          <br>
          I noticed that example code 'doc/examples/transcoding.c'
          produces in <br>
          correct FPS if it's used with MP4 container. Encoded video
          type doesn't <br>
          seem to be the case as I tested H264 and MPEG4 and both were
          nearly <br>
          identical.<br>
          <br>
          With sort videos it's not much just something like 21,85 fps
          with 24 fps <br>
          video but longer ones can be something like 0.05 fps.<br>
          <br>
          That it what ffprobe dump and when you play them they are
          really lagging <br>
          as they go so slow. Packets seems to be correct and it neither
          wise not <br>
          broken.<br>
          <br>
          I don't know if this just feature or is this as bug. With
          ffmpeg same <br>
          source file produces correct file with correct fps.<br>
          <br>
          Sincerely,<br>
          <br>
          Tuukka<br>
          <br>
          _______________________________________________<br>
          Libav-user mailing list<br>
          <a href="mailto:Libav-user@ffmpeg.org" target="_blank"
            moz-do-not-send="true">Libav-user@ffmpeg.org</a><br>
          <a href="https://ffmpeg.org/mailman/listinfo/libav-user"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
          <br>
          To unsubscribe, visit link above, or email<br>
          <a href="mailto:libav-user-request@ffmpeg.org" target="_blank"
            moz-do-not-send="true">libav-user-request@ffmpeg.org</a>
          with subject "unsubscribe".</blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Libav-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a class="moz-txt-link-freetext" href="https://ffmpeg.org/mailman/listinfo/libav-user">https://ffmpeg.org/mailman/listinfo/libav-user</a>

To unsubscribe, visit link above, or email
<a class="moz-txt-link-abbreviated" href="mailto:libav-user-request@ffmpeg.org">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</pre>
    </blockquote>
  </body>
</html>