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

rkmr.em at gmail.com rkmr.em
Mon Apr 23 20:20:33 CEST 2007


On 4/23/07, M?ns Rullg?rd <mans at mansr.com> wrote:
>
> "rkmr.em at gmail.com" <rkmr.em at gmail.com> writes:
> > On 4/23/07, Michel Bardiaux <mbardiaux at mediaxim.be> wrote:
> >>
> >> 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:
> >> >>>>> 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
> >> >>
> >> >> BBIBBPBBPBBP|BBIBBPBBPBBP|...
> >
> > This is exactly the frame strucuture and is a hardware encoder that is
> > producing this stream!!
> >> > 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
> > So it is not possible to decode the first two frames?  Is this true
> > even with the latest svn version of ffmpeg?
>
> The first frame produced when the decoder is switched on must be
> possible to decode somehow.  If you jump into the stream at a later
> point you'll always have a couple of initial B-frames with one
> reference before your starting point.  Not even FFmpeg can invent this
> missing data.  The decoder copes with it just fine though, so there's
> no big deal.


I am building a frame accurate video decoder using ffmpeg and I need to be
able to decode those frames. Would a hack like this work? Ask ffmpeg to
first decode the third frame or I-frame and then go to the B-Frames? Would
that make sense?
thanks




More information about the ffmpeg-devel mailing list