I have a so-called "block" that stores some of the MPEG4 frames (I, p, p, p, p ...). For each "block", the frame begins with frame "I" and ends before the next "I" frame. (VOL - "visual_object_sequence_start_code" is always on before frame "I")
I need to be able to play these “blocking” frames in backward mode. The thickness is as follows:
It is impossible to simply take the last frame in my block and perform decoding, because it is a “P” frame, and it needs to decode “inter-frame (I)” correctly.
I can’t just take my first “I” frame and then pass it to the ffmpeg function “avcodec_decode_video” and only then pass my last “P” frame to ffmpeg, because this last “P” frame depends on the “P” frame before it , right? (well ... as far as I tested this method, my last decoded P-frame had artifacts)
Now the way that I perform reverse playback is to first decode all my “block” frames in RGB and store them in memory. (in most cases it will be ~ 25 frames per max block.) But this method really requires a lot of memory ... (especially if the frame resolutions are high) And I have the feeling that this is the wrong way to do it ...
So, I would like to ask if anyone has any suggestions on how this “reverse” decoding / playback of frames can be done using FFmpeg?
thanks
source share