[FFmpeg-devel] Google Summer of Code participation

Kostya kostya.shishkov
Sat Mar 28 20:46:46 CET 2009

On Sat, Mar 28, 2009 at 05:51:53PM +0100, Thilo Borgmann wrote:
> Kostya schrieb:
> >On Sat, Mar 28, 2009 at 12:20:32PM +0100, Thilo Borgmann wrote:
> >
> >I've looked at it once. If you use PNG decoder for that frames you'll see
> >good picture for the first frame and many colourful dots on the latter. 
> >That's
> >because its developer(s) decided to store latter frames as a difference to
> >the key frame and you have to use demuxer keyframe flag to distinguish 
> >between
> >both.
> >
> >Download http://samples.mplayerhq.hu/V-codecs/PNG1/corepng.avi
> >run
> >ffmpeg -i corepng.avi -f image2 -vcodec copy %04d.png
> >and see that for yourself.
> >
> >P.S. We of FFmpeg welcome creativity since it's not that rare when the only
> >information about codec is located in libavcodec/*.c
> >  
> Ok next problem arises. I'm currently trying to distinguish the I and P 
> frames to be decoded.
> As you mentioned, I tried to check the keyframe flag, that comes from 
> 'outside'.
> For that, I "av_log"ed the "key_frame" and "pict_type" attributes:
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> static int decode_frame(AVCodecContext *avctx,
>                        void *data, int *data_size,
>                        const uint8_t *buf, int buf_size)
> {
>    PNGDecContext * const s = avctx->priv_data;
>    AVFrame *picture = data;
>    AVFrame * const p= &s->picture;
> #ifdef DEBUG
> av_log(avctx, AV_LOG_DEBUG, "data->key_frame: %i, data->pict_type: %d\n",
>       picture->key_frame, picture->pict_type);
> av_log(avctx, AV_LOG_DEBUG, "s->picture->key_frame: %i, 
> s->picture->pict_type: %d\n",
>       p->key_frame, p->pict_type);
> #endif
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> (source listing is highly mailing list dependent - tell me how you like 
> it if this is a pain in your eyes)
> As these debug outputs are telling that every frame is a key frame, 
> which most of them are not, the question is if I'm looking at the wrong 
> attributes or if this information is not parsed at all?
> I'm asking that question because you seem to know how to distinguish 
> these frames, if not, I'll have to trace the assignment of these 
> attributes before the decode_frame function is called.
> (Which I've already tried but the jungle of files out there didn't want 
> me to find it quickly...)

Had I knew how it is set, we should have that decoder for several years :(

Look into libavcodec/utils.c, all generic functions for calling decoder
should be there.
> TB

More information about the ffmpeg-devel mailing list