[FFmpeg-devel] mpeg4 frames decode

Michael Niedermayer michaelni
Tue Aug 14 22:12:18 CEST 2007


Hi

On Tue, Aug 14, 2007 at 07:47:45PM +0400, Artem Korneev wrote:
> Hello.
> 
> 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 

try to dump all packets to a file, try to play them with ffmpeg -f m4v
if it fails the problem is in the data (likely missing headers or such)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070814/e5054ef4/attachment.pgp>



More information about the ffmpeg-devel mailing list