[Ffmpeg-devel] first frame wrong

Glenn Maynard glenn
Tue Mar 20 22:54:40 CET 2007

> I've made a wrapper of the last ffmpeg for using in my program. I send all
> the parameters to a function that replies the ffmpeg.c and I obtain the same
> results as I was just using the ffmpeg.
> But I still have a problem about the first frame of some file...
> If I extract the first image of a video it looks damaged
> If I extract a video from frame 0 to 30 for example (-vframes 31) I get a
> video formed by 31 frames but starting from frame 2 and ending to the frame
> 32 (fr 0 and fr 1 skipped).

I just hit this problem.  For me, it turned out to be that my protocol
handler was being passed "AVSEEK_SIZE".  That's not a real fseek code;
it ended up rewinding my stream.  If you're using a protocol handler,
be sure to return -1 on unknown codes.

This bit me pretty badly during an upgrade, taking several hours to
track down why looping videos were jerking on loop.  Maybe a sanity
check is in order: in url_open, call url_seek with an invalid whence.
If it doesn't return < 0, fail the open.  That way, the failure is
much easier to diagnose.

Glenn Maynard

More information about the ffmpeg-devel mailing list