[Libav-user] ERROR: avcodec_decode_video2() return 1

손남례 nrson at win4net.com
Wed Apr 18 03:49:59 CEST 2012

Hi All!

I am new ffmpeg user and english.

Recently I decodes H.264 stream from IP camera using FFMpeg which the
latest ver 54(libavcodec) and binary file(dll) on Window.

Whenever I decoded sample file which is avcodec_sample.cpp using
avcodec_decode_video2( ), I always received the return value -1.

I referenced your comment(http://www.mail-archive.com/libav-
user at mplayerhq.hu/msg04939.html), but my return value is 1 and gop_picture
is 0.

I don’t know How do I solve the problem?

Are you help me?


Best regards,



PS: I can decode previous version(52) using avcodec_decode_video( ), but
can’t decode H.264 stream using avcodec_decode_video2( ).

I thought that av_packet_init() is necessary to initialize to decode as


           int64_t tmp = 0x8000000000000000; //AV_NOPTS_VALUE

           avpkt.pts                     =       tmp;

           avpkt.dts                     =        tmp; 

           avpkt.pos                     =       -1; 

           avpkt.duration              =        0; 

           avpkt.stream_index         =        0; 

           avpkt.destruct               =         NULL;

           avpkt.priv                    =         NULL;

           avpkt.side_data             =         NULL;

           avpkt.side_data_elems     =         0;

           avpkt.convergence_duration        =        0;

           avpkt.flags        = AV_PKT_FLAG_KEY; 

           avpkt.data         = NULL;

           avpkt.size          = 0;


After seeing the h264.c source, there is not use the avpkt structure except
avpkt.data and avpkt.size.

Another problem is happen to me….Help Help…!!!!!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120418/fb7bb216/attachment.html>

More information about the Libav-user mailing list