[Ffmpeg-devel] problem decoding frames when first frame is B

Michel Bardiaux mbardiaux
Mon Apr 23 16:55:15 CEST 2007

M?ns Rullg?rd wrote:
> Michel Bardiaux wrote:
>> rkmr.em at gmail.com wrote:
>>> On 4/20/07, M?ns Rullg?rd <mans at mansr.com> wrote:
>>>> "rkmr.em at gmail.com" <rkmr.em at gmail.com> writes:
>>>>> I have a valid MPEG-2 video stream in which the first two frames are
>>>>> B-frames. ffmpeg is not able to decode those two frames:
>>>>>                        avcodec_decode_video( m_vDec, m_decodedPicture,
>>>>> &got_picture, (uint8_t*) samplePtr, sampleLength );
>>>>> got_picture is 0 for the first two frames. Is this a know problem?
>>>> Upload a sample, please.
>>> can you tell how to do this? it is a 49MB file.
>>> Do you mean that the first frame is a B-frame with only intra coded
>>>> blocks, or that the first frames in display order are B-frames
>>>> predicted against a following (display order) I-frame, which is the
>>>> first coded frame?
>>> the display order is like this:
>>> BBIBBP..
>>> I am not sure how it is actually coded.
>> I have seen MPEG (1, not 2) streams coming from hardware encoders and
>> having that structure. The full GOP structure was
>> the 2 leading B-frames being coded against the last P-frame of the
>> preceding GOP. A typical not-closed GOP. And a nightmare to decode.
> The only problem is that you don't have the reference frame for the first
> couple of frames.  Nothing to worry about once you've got the first two
> non-B frames.  Open GOP makes some sense when random access is impossible,
> such as broadcast, which is where it is primarily found.  DVD uses closed
> GOP.

I think their motivation was that the 4x3 sequence, BBI/BBP/BBP/BBP, 
made for simpler circuitry. These were mid/end-90s hardware encoders, at 
that time that would have been a factor.

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

More information about the ffmpeg-devel mailing list