[FFmpeg-devel] mpeg4 frames decode

Artem Korneev tema
Tue Aug 14 17:47:45 CEST 2007


I have some questions about libavcodec library usage. Is it suitable 
place to ask?..

I need to decode mpeg4 stream, incoming from the network. Packets of 
incoming stream contains some additional information - timestamp, key 
frame sign, frame, encoded by CODEC_ID_MPEG4 and size of the frame.
I try to decode this stream, but I can not to do it yet. There is some 
lines of code below:

// -------------------------------------------------------------
data.inCodec = avcodec_find_decoder(CODEC_ID_MPEG4);
data.inCtx = avcodec_alloc_context();
data.inCtx->width = 320;
data.inCtx->height = 240;
data.inCtx->time_base.num = 1;
data.inCtx->time_base.den = 30;
data.inCtx->max_b_frames = 0;
data.inCtx->pix_fmt = PIX_FMT_YUV420P;
if (avcodec_open(data.inCtx, data.inCodec) < 0) {...}
// -------------------------------------------------------------

So, I created codec context and initialize codec. After that I call 
avcodec_decode_video, but this procedure returns 0 only. So, none frames 
was decoded.
The picture size (320 x 240), codec (CODEC_ID_MPEG4) and pix_fmt I know 
from the source code of the program, which sends video stream.

Anybody can help me to solve this problem? Are there any other things 
which needs to be initialized? How I can find a root of the problem? Is 
there any opportunities to debug this kind of problems with libavcodec?

More information about the ffmpeg-devel mailing list