[Libav-user] avcodec_decode_video2

Neil Menne nhmenne42 at students.tntech.edu
Thu Dec 29 17:26:15 CET 2011


So editing the buffer's header is the next step?
On Dec 29, 2011 11:24 AM, "Alex Cohn" <alexcohn at netvision.net.il> wrote:

> On Wed, Dec 28, 2011 at 23:55, Neil Menne <nhmenne42 at students.tntech.edu>
> wrote:
> > I'll start from the beginning to see if we can find the problem: I do the
> > register all; I do a find_decoder (which is currently looking for
> > "CODEC_ID_H264"); if that's successful, I allocate the context (using
> > alloc_context3); I then do an avcodec_open2 with arguments of my
> context, my
> > codec, and NULL for the dictionary; if this succeeds, I allocate the
> frame;
> > next, I initialize a packet and set the packets data to the buffer I
> > received which contains the H264 video; if that all works, i do a
> > decode_video2.
> >
> > The return is a -1 as i save it to a unique variable and print the result
> > immediately; it also states that whole "no frame!" prior to my printout
> of
> > the result.
>
> It's natural to receive -1 from decode_video2() for the first few
> frames -- the number depends on your stream (how many b-frames are
> allowed). The question about -1 pops up from time to time. The problem
> is, some H264 streams or files have non-zero b-frame count in the
> header, even if they actually carry no b-frames. It is not
> unacceptable to edit the header before it is interpreted by the H264
> decoder, to reset the flag to zero.
>
> > I feel like it's tied into either the AVCodecContext or the AVPacket
> > (something I'm not populating in the packet besides supplying the
> buffer);
> > but that's just a guess at this point.
> >
> > Thanks for taking time to look at this problem.
> >
> > -Neil
> >
> > P.S. If it matters, I'm using Live555 (because I need direct access to
> some
> > of the RTP related data) to pull down my RTSP stream and passing along
> the
> > buffer it returns.
> >
> > On Wed, Dec 28, 2011 at 4:39 AM, Alex Cohn <alexcohn at netvision.net.il>
> > wrote:
> >>
> >> On Wed, Dec 28, 2011 at 01:19, Neil Menne <
> nhmenne42 at students.tntech.edu>
> >> wrote:
> >> > How do I pass a raw buffer into this function?
> >> >
> >> > I find the appropriate codec and codec context, allocate the AVFrame,
> >> > and
> >> > initialize the packet. When I try and set the packet's data to the
> >> > buffer:
> >> > AVPacket packet;
> >> > av_init_packet(&packet);
> >> > packet.data = buf;
> >> >
> >> > where buf is the buffer received; I'm getting an error that seems to
> be
> >> > unrelated. It says "no frame!" and returns -1.
> >>
> >> Are you sure you receive -1 from the code above? maybe, some important
> >> line of code is missing in your post?
> >> -Alex
> >>
> >> > If it helps, my AVFrame is initialized with:
> >> > codecFrame = avcodec_alloc_frame();
> >> >
> >> > -Neil
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111229/5cf28cba/attachment.html>


More information about the Libav-user mailing list