[FFmpeg-devel] add AVSEEK_FLAG_FRAME

Ivan Schreter schreter
Sun Aug 16 15:31:02 CEST 2009

Michael Niedermayer wrote:
> On Sat, Aug 15, 2009 at 02:33:36PM +0200, Ivan Schreter wrote:
> [...]
>> Maybe a generic implementation by computing a timestamp based on frame rate 
>> would be appropriate in avformat_seek_file?
> doesnt work, we need the filepos based seeking for formats like MPEG-PS/TS
> that have timestamp discontinuities and thus no reliable seeking per
> timestamp (one of course can seek based on guessing about the discontinuities
> but filepos is the well defined alternative if the user dislikes our, to be
> implemented guessing)
Uhm, but current seeking implementation for timestamp seeking for 
MPEG-PS/TS also doesn't cope with timestamp discontinuities at all, as 
it's not possible to seek by timestamp or frame reliably as long as 
there are discontinuities. So I don't see this as a problem. Using 
timestamp = frame * frame_rate / time_base would be the generic 
solution, so not every format parser has to implement it's own solution 
how to position based on frames. Someone just has to put an if condition 
and the above formula to avformat_seek_file.

Of course, filepos-based seeking (AVSEEK_FLAG_BYTE) is still necessary 
as you pointed out for files with discontinuities. I'm now addressing 
this as well in my patches for MPEG-TS/PS seeking.



More information about the ffmpeg-devel mailing list