title: MPEG backwards frame decoding using FFmpeg
body: <p>I have so-called "block's" that stores some of MPEG4 (I,p,p,p,p...) frames.
  For every "block", frame starts with an "I" frame, and ends before next "I" frame.
  (VOL - "visual_object_sequence_start_code" is allways included before the "I" frame)</p>
  
  <p>I need to be able to play those "block" frames in "backwards" mode.
  The thick is that:</p>
  
  <ol>
  <li><p>It's not possible to just take the last frame in my block and perform decoding, because it's a "P" frame and it needs an "inter frame (I)" to be correctly decoded.</p></li>
  <li><p>I can't just take my first "I" frame, then pass it to the ffmpeg's "avcodec_decode_video" function and only then pass my last "P" frame to the ffmpeg, because that last "P" frame depends on the "P" frame before it, right? (well.. as far as I've tested this method, my last decoded P frame had artifacts)</p></li>
  </ol>
  
  <p>Now the way I'm performing backwards playing is - first decoding all of my "block" frames in RGB and store them in memory. (in most cases it would be ~25 frames per block max.) But this method really requires a lot of memory... (especially if frames resolutions is high)
  And I have a feeling that this is not the right way to do this...</p>
  
  <p>So I would like to ask, does any one have any suggestions how this "backwards" frame decoding/playing could be performed using FFmpeg?</p>
  
  <p>Thanks</p>