[Libav-user] avcodec_decode_video2

Neil Menne nhmenne42 at students.tntech.edu
Wed Dec 28 22:55:06 CET 2011


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.

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/20111228/46d8322d/attachment.html>


More information about the Libav-user mailing list