[Ffmpeg-devel] mpeg4 stream decoding

Stephen DiVerdi sdiverdi
Sun Nov 20 11:46:58 CET 2005

hello, i just joined the list as i'm using ffmpeg to handle 
encoding/decoding a video stream for live streaming over a network, and 
i've run into a problem.  i'd like to use mpeg4 for the transfer format, 
but according to the apiexample.c file's comments, the mpeg4 codec 
requires that encoded data is passed to avcodec_decode_video exactly one 
frame at a time - that is, that the incoming data is broken on frame 
boundaries.  of course, there's no way to know that without parsing the 
encoded data itself, which is what i wanted ffmpeg to do for me. =)

based on what's in avcodec.h, it looks like AVCodecParser is what i need 
to interpret the encoded video data and tell me where the frame boundaries 
are so i can break it up properly, but there's no documentation i can find 
anywhere on how to use the parser functions.  specifically, the function

int av_parser_parse(AVCodecParserContext *s,
                     AVCodecContext *avctx,
                     uint8_t **poutbuf, int *poutbuf_size,
                     const uint8_t *buf, int buf_size,
                     int64_t pts, int64_t dts);

seems to be the meat of it, and i can't tell what to pass in for pts or 
dts, or how to interpret the results in poutbuf and poutbuf_size.  can 
anyone explain how this works, or send along some example code or 
something to clear it up for me?  or let me know if i'm way off base here? 
i'd appreciate it very much!


-steve diverdi
-sdiverdi at cs.ucsb.edu

More information about the ffmpeg-devel mailing list