title: Strange fluctuating behaviour in time difference between successive frames read
body: <p>Intuitively I would assume that using the function <code>readFrame(videoObj)</code> to read each frame would change the attribute <code>videoObj.CurrentTime</code> as such:</p>
  
  <pre><code>videoObj.CurrentTime = videoObj.CurrentTime + videoObj.FrameRate * videoObj.Duration
  </code></pre>
  
  <p>I.e. whenever each frame is extracted from <code>videoObj</code>, <code>videoObj.CurrentTime</code> is set to the time value in the video file where the next frame is located. </p>
  
  <p>However, by observing how the attribute <code>videoObj.CurrentTime</code> changes throughout the reading of the video file, I see that the above is <strong>almost</strong> correct. (see the bottom of this question)</p>
  
  <p>So, does anyone have an idea of why the time difference between successive frames is fluctuating? </p>
  
  <p>Here is the code used to plot the time difference between successive frames during reading.</p>
  
  <pre><code>video = VideoReader('filename');
  time = zeros(video.FrameRate * video.Duration,2);
  time(1,1) = video.CurrentTime;
  i = 2;
  while hasFrame(video)
      frame = readFrame(video);
      time(i,1) = video.CurrentTime;
      time(i,2) = time(i,1)-time(i-1,1);
      i = i + 1;
  end
  
  figure;plot(time(:,1),time(:,2),'*')
  xlabel('elapsed time in the video')
  ylabel('time difference between frames')
  </code></pre>
  
  <p>And here is a plot over the variable <code>time</code>, <a href="http://oi62.tinypic.com/2ykf7zm.jpg" rel="nofollow">http://oi62.tinypic.com/2ykf7zm.jpg</a>. (SO wouldn't let me upload the figure here, because I don't have enough reputation points).</p>
  
  <p>If you feel uncomfortable clicking the link, here are some relevant snippets of the variable <code>time</code>. The left column is the elapsed time in the video, i.e. <code>videoObj.CurrentTime</code> during the reading, and the right column is the increase in <code>videoObj.CurrentTime</code> in each reading.</p>
  
  <p><code>0      0
  0.0660  0.0660
  0.1330  0.0670
  0.2000  0.0670
  0.2660  0.0660
  0.3330  0.0670
  0.4000  0.0670
  0.4660  0.0660
  0.5330  0.0670
  0.6000  0.0670</code></p>
  
  <p>...</p>
  
  <p><code>1.4660 0.0660
  1.5330  0.0670
  1.6000  0.0670
  1.7330  0.1330
  1.8000  0.0670
  1.8660  0.0660
  1.9330  0.0670
  2       0.0670</code></p>
  
  <p>As you can see the time difference between each reading fluctuates between 0.0660 and 0.0670. This can probably be explained by the precision of approximating floating numbers (but isn't a precision of order 10^-3 very bad anyway?). BUT, at some points, the difference is twice as much as it should be, with a value of 0.1330. I.e. it seems that <code>readFrame(videoObj)</code> skips a frame. How can I make sure that this doesn't happen? </p>