[FFmpeg-devel] Reordering of GOP Frames

Axel Gallus uh5d
Thu Sep 13 00:35:29 CEST 2007


Can please someone comment on my thoughts...

Lets say we have the following display sequence: I B B P
Where both B's depend on the following P.
Therefore the above sequence has be arranged to I P B B in the videofile.

1.)    av_read_frame() first reads I in AVPacket struct.
        avcodec_decode_frame() decodes AVPacket and has complete frame, because I = Keyframe 
        frame gets converted and shown ( e.g. via sws_scale() )

2.)    av_read_frame() reads P in AVPacket struct.
        avcodec_decode_frame() decodes AVPacket and signals no frame, because it must'nt show it at this time.
        So the P-Frame just gets buffered
       
3.)    av_read_frame() reads B in AVPacket struct.
        avcodec_decode_frame() decodes AVPacket and has complete frame, because P frame already has been decoded
        frame gets converted and shown ( e.g. via sws_scale() )

4.)    av_read_frame() reads B in AVPacket struct. 
        avcodec_decode_frame() decodes AVPacket and has complete frame, because P frame already has been decoded
        frame gets converted and shown ( e.g. via sws_scale() )

5.)    av_read_frame() now reads P in AVPacket struct. !??!
        avcodec_decode_frame() has complete frame, because P frame already has been decoded and buffered
        frame gets converted and shown ( e.g. via sws_scale() )


Are those thought right 5 reads for 4 frames?
If not, when does the P-frame get shown?

Regards

A.Gallus






More information about the ffmpeg-devel mailing list