[FFmpeg-devel] Reordering of GOP Frames
Michel Bardiaux
mbardiaux
Thu Sep 13 11:43:11 CEST 2007
Axel Gallus a ?crit :
> 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()
There aint no such animal. I guess you mean avcodec_decode_video.
> decodes AVPacket and has complete frame,
No.
> 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
No, the I-frame comes out.
>
> 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() )
Yes (but amended to: because P *and* I ...)
>
> 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() )
Ditto.
>
> 5.) av_read_frame() now reads P in AVPacket struct. !??!
Reads *another* P-frame.
> 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() )
The *first* P-frame comes out.
>
>
> Are those thought right 5 reads for 4 frames?
> If not, when does the P-frame get shown?
>
PS: the above assumes the LOW_DELAY flag is not set. If it is set, and
the stream is I/P only, then each call to avcodec_decode_video returns
the decoded frame corresponding to the compressed data given it.
I dont know what happens if you use LOW_DELAY with B frames. AFAIK it is
illegal (not to mention immoral and fattening :-) )
--
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be
Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/
More information about the ffmpeg-devel
mailing list