title: ffmpeg vstats problems, Missing frames and misleading information!
body: <p>The Problem I have is when using ffmpeg to encode a YUV using libx264 I don't get all the frame information in -vstats output. It raises the question of how reliable ffmpeg is, and therefore can any 'codec benchmark' review based on ffmpeg be trusted?</p>
  
  <p>I am analysing codec's to determine how they perform. I am using ffmpeg and its -vstats option to look at an encoded movie frame by frame. the process I use:</p>
  
  <p>RAW YUV -> bar-code each frame with frame number -> Bar-coded YUV</p>
  
  <p>Bar-coded YUV -> encoded (e.g. with libx264) -> MKV -> Decoded to YUV</p>
  
  <p>I can compare the two outputs ('Bar-coded YUV' &amp; 'Decoded to YUV') using the bar-code in each frame. I can then compare, exactly, an original frame with an encoded frame using PSNR etc.</p>
  
  <p>When encoding using libx264 and libdirac, there are some frame information which is missing. Other codecs, such as mpeg2video or even libvpx, don't have this problem.</p>
  
  <p>I have found that libx264 vstats are missing for the first 40 to 50 frames. I have since proved that the missing information is actually the last 40 to 50 frames. </p>
  
  <p>It also looks like ffmpeg calculates average bitrate based on the information in vstats. But as there is missing frames the average bitrate is less than what it should be.</p>
  
  <p>Below are links to the average bitrate error example:</p>
  
  <p><a href="http://dl.dropbox.com/u/6743276/ffmpeg_probs/ffmpeg_av_bitrate_error.png" rel="nofollow">http://dl.dropbox.com/u/6743276/ffmpeg_probs/ffmpeg_av_bitrate_error.png</a></p>
  
  <p><a href="http://dl.dropbox.com/u/6743276/ffmpeg_probs/ffmpeg_av_bitrate_error.xlsx" rel="nofollow">http://dl.dropbox.com/u/6743276/ffmpeg_probs/ffmpeg_av_bitrate_error.xlsx</a></p>
  
  <p>Below is a link to the PSNR &amp; f_size graph:</p>
  
  <p><a href="http://dl.dropbox.com/u/6743276/ffmpeg_probs/frame_mismatch.png" rel="nofollow">http://dl.dropbox.com/u/6743276/ffmpeg_probs/frame_mismatch.png</a></p>
  
  <p>Below is a link to the output &amp; command line options:</p>
  
  <p><a href="http://dl.dropbox.com/u/6743276/ffmpeg_probs/stderr.txt" rel="nofollow">http://dl.dropbox.com/u/6743276/ffmpeg_probs/stderr.txt</a></p>
  
  <p>I think this is also a bug, anyone clever enough to work it out might want to follow this tracker:
  <a href="http://roundup.ffmpeg.org/issue2248" rel="nofollow">http://roundup.ffmpeg.org/issue2248</a></p>