Hello,<div>I am attempting to sequentially fetch frames from a movie encoded with libx264. I am using a typical av_read_frame / av_decode_video2 loop (found in most demos out there) to fetch each frames. Like this:</div><div>
<br></div><div><div><font face="courier new, monospace">int nbFrames = 0;</font></div><div><font face="courier new, monospace">while ( av_read_frame () >= 0 )</font></div><div><font face="courier new, monospace">{</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>av_decode_video2(&frameFinished);</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">     </span>if ( frameFinished )</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>{</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">         </span>nbFrames++;</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">       </span>}</font></div>
<div><font face="courier new, monospace">}</font></div></div><div><font face="courier new, monospace"><br></font></div><div>Now, my video file has 1000 frames, but after the loop runs, nbFrames only got incremented to 994.<font face="courier new, monospace"><br>
</font></div><div><br></div><div>So, my question is this: why would I only get 994 complete frames out of 1000? Clearly this has to do with some sort of DTS / PTS issue, but I was under the impression that this type of loop ensured that frames would be reordered properly (hence if(frameFinished)).</div>
<div><br></div><div>(btw, if I dump all frames using cmdline ffmpeg, I get 1000 files..., so my video file is not corrupted or anything like that);</div><div><br></div><div>Any insight would be greatly appreciated!</div><div>
<br></div><div>regards,</div><div>—Dominic</div><div><br></div>