<div dir="ltr">Hi friends,<div><br></div><div>Here I have a question about AVFrame pts needs your help.</div><div><br></div><div>My application uses av_read_frame to get packets and then calls  avcodec_decode_video2 to get video frames. But recently I found one specific video file generates strange pts/dts.</div>
<div><br></div><div>Below is a part of the log:</div><div><br></div><div>00:00:17.301  MAIN  timestamp_debug:  pkt.pts = -9223372036854775808, dts = 0</div><div>00:00:17.301  MAIN  timestamp_debug:            frame.pkt_pts = -9223372036854775808, frame.pkt_dts = -9223372036854775808, frame.pts = -9223372036854775808</div>
<div>00:00:17.301  1108  FFMPEG: looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag</div><div><br></div><div>00:00:17.301  MAIN  timestamp_debug:  pkt.pts = -9223372036854775808, dts = 1</div>
<div>00:00:17.301  MAIN  timestamp_debug:            frame.pkt_pts = -9223372036854775808, frame.pkt_dts = -9223372036854775808, frame.pts = -9223372036854775808</div><div>00:00:17.301  MAIN  timestamp_debug:  pkt.pts = -9223372036854775808, dts = 2</div>
<div>00:00:17.301  MAIN  timestamp_debug:            frame.pkt_pts = -9223372036854775808, frame.pkt_dts = -9223372036854775808, frame.pts = -9223372036854775808</div><div>00:00:17.301  MAIN  timestamp_debug:  pkt.pts = -9223372036854775808, dts = 3</div>
<div>00:00:17.301  MAIN  timestamp_debug:            frame.pkt_pts = -9223372036854775808, frame.pkt_dts = -9223372036854775808, frame.pts = -9223372036854775808</div><div>00:00:17.301  MAIN  timestamp_debug:  pkt.pts = -9223372036854775808, dts = 4</div>
<div>00:00:17.301  MAIN  timestamp_debug:  [a full frame : frame.pkt_pts = -9223372036854775808, frame.pkt_dts = 0], frame.pts = 0 </div><div><div>00:00:18.393  LVid236  timestamp_debug:  pkt.pts = -9223372036854775808, dts = 5</div>
<div>00:00:18.408  LVid236  timestamp_debug:  [a full frame : frame.pkt_pts = -9223372036854775808, frame.pkt_dts = 1], frame.pts = 0</div><div>00:00:18.439  LVid236  timestamp_debug:  pkt.pts = -9223372036854775808, dts = 6</div>
<div>00:00:18.439  LVid236  timestamp_debug:  [a full frame : frame.pkt_pts = -9223372036854775808, frame.pkt_dts = 2], frame.pts = 0</div><div>00:00:18.439  LSou259  FFMPEG: first_dts 0 not matching first dts 113424 in the queue</div>
</div><div><div>00:00:18.486  LVid236  timestamp_debug:  pkt.pts = -9223372036854775808, dts = 7</div><div>00:00:18.486  LVid236  timestamp_debug:  [a full frame : frame.pkt_pts = -9223372036854775808, frame.pkt_dts = 3], frame.pts = 0</div>
<div>00:00:18.517  LVid236  timestamp_debug:  pkt.pts = -9223372036854775808, dts = 8</div><div>00:00:18.517  LVid236  timestamp_debug:  [a full frame : frame.pkt_pts = -9223372036854775808, frame.pkt_dts = 4], frame.pts = 0</div>
<div>00:00:18.549  LSou259  FFMPEG: first_dts 0 not matching first dts 114675 in the queue</div></div><div><br></div><div>We can see that, it was until 4th packet is sent to decode function that we got the first full frame. and all frames had pts = 0</div>
<div><br></div><div>So here I want to know, frame.pts, frame.pkt_dts, packet,dts. which is best to represent the time stamp of a video frame (I mean pts, but in this case, no pts is valid).</div><div><br></div><div>For example, in this case, for the 1st frame, should I use frame.pkt_dts (that's 0), or pkt.pts (the last packet that generates this frame, in this case 4) as the time  position </div>
<div>of the frame?</div><div><br></div><div>The file I used to test is here <a href="https://dl.dropboxusercontent.com/u/89678527/av_divx_24_yuv420p_mp3_44100_2_1.avi">https://dl.dropboxusercontent.com/u/89678527/av_divx_24_yuv420p_mp3_44100_2_1.avi</a></div>
<div><br></div><div>Thanks</div></div>