[FFmpeg-devel] seek problems with AVSEEK_FLAG_BYTE

Don Moir donmoir at comcast.net
Sun Apr 22 09:36:48 CEST 2012

Normally, I always use seek by timestamp, but I was tuning some things that have to do with seamless loops.

I noticed a slightly quicker response when using AVSEEK_FLAG_BYTE. Just a slight hitch on slower machines when seeking by timestamp to the start of the file and no hitch with AVSEEK_FLAG_BYTE when it worked.

so given:

avformat_seek_file (pFormatCtx,-1,INT64_MIN,pFormatCtx->data_offset,INT64_MAX, AVSEEK_FLAG_BYTE);

This works alot of the time but fails for some formats. e.g. timestamps will be off etc. Seems seek_frame_byte just doesn't do enough to reset some internal data so the timestamps are correct after a seek by byte. I noticed this with avi and matroska so far but there are probably others. ff_read_frame_flush is called prior to calling seek_frame_byte and maybe thats not doing enough.

I will post a ticket on it if you think this should be addressed. Not sure if it was fixed if it would still be faster but should be.

The other side of this is that since AVSEEK_FLAG_BYTE is valid and documented, it should work.

More information about the ffmpeg-devel mailing list