Video decoders don't always give you decoded frames in the order you should display them. Have a look at http://dranger.com/ffmpeg/tutorial05.html for an explanation of what's going on.
Mischa Spiegelmock On Wed, Jul 13, 2011 at 8:52 AM, Ronald S. Bultje <[email protected]> wrote: > Hi, > > On Wed, Jul 13, 2011 at 7:35 AM, wecing <[email protected]> wrote: >> Hello, >> >> I have a function, get_vp(), which works like this: >> if end of video file: >> return NULL; >> AVFrame *ret = avcodec_alloc_frame(); >> fill ret with a new frame; >> return ret; >> >> When I use it in this way, everything is ok: >> AVFrame *vp = get_vp(); >> while(vp != NULL) { show vp; free vp; vp = get_vp(); } >> >> But when I rewrote my program like this... the output is a mess: >> frames I got were not in the correct order. >> AVFrame *vp_a = get_vp(); AVFrame *vp_b = get_vp(); >> while(vp_a != NULL) { show vp_a; free vp_a; vp_a = vp_b; vp_b = get_vp(); >> } >> (For some formats, this works ok.) > > OK, let's start with the simple test case. This should work. It sounds > to me like your program is a little more complex than this and does > something else wrong. Can you minimize the testcase or debug the > differences between this sample code and your program? > > Ronald > _______________________________________________ > libav-api mailing list > [email protected] > https://lists.libav.org/mailman/listinfo/libav-api > _______________________________________________ libav-api mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-api
