[Libav-user] avcodec_decode_video2 decode h264 file return -1

曲亚东 quyadong at hotmail.com
Wed Nov 9 08:32:24 CET 2011









hi all,
 
I write a H264
decode program referring to the following link:
http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html
Because I use the FFmpeg 0.8.6, I change this sample from avcodec_decode_video to avcodec_decode_video2, just like the following codes:
 
AVPacket g_avpkt;


bool GetNextFrame(AVFormatContext *pFormatCtx, AVCodecContext *pCodecCtx, int videoStream, AVFrame *pFrame)


{

.........
if(av_read_frame(pFormatCtx, &g_avpkt)<0)    bytesDecoded=avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &g_avpkt);


.........
Firstly av_read_frame
read some data from an h264 file(D1), but avcodec_decode_video2 always
return with -1. I have tried these code with h264 file(safe), it is ok. How to use avcodec_decode_video2 to decode h264 files correctly? Thanks a lot.  
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111109/c5815522/attachment.html>


More information about the Libav-user mailing list