title: Why is packet.pts != frame->pkt_pts in AVFrame?
body: <p>Trying to understand some audio/video sync issues via ffmpeg, I noticed the following. Running this code</p>
  
  <pre><code>while (av_read_frame(formatCtx, &amp;packet) &gt;= 0)
  {
     if (packet.stream_index == videoStream)
     {
        avcodec_decode_video2(videoCodecCtx, frame, &amp;got_frame, &amp;packet);
     }
  
     printf("packet.pts = %d\n", packet.pts);
     printf("frame-&gt;pkt_pts", frame-&gt;pkt_pts);
  }
  </code></pre>
  
  <p>shows that frame->pkt_pts in general differs from packet.pts, despite the documentation claiming that frame->pkt_pts is the</p>
  
  <blockquote>
    <p>PTS copied from the AVPacket that was decoded to produce this frame</p>
  </blockquote>
  
  <p>Moreover I noticed that the difference between the two is big exactly at the places where audio and video are out of sync.</p>
  
  <p>So, why is <code>packet.pts != frame-&gt;pkt_pts</code> ? </p>