[FFmpeg-devel] matroska file hits eof on any seek

Don Moir donmoir at comcast.net
Fri Feb 17 21:51:43 CET 2012

>> On Fri, Feb 17, 2012 at 04:45:30AM -0500, Don Moir wrote:
>>>> The only recovery is to shut the file down and reopen it.
>>> I forgot to say: almost certainly not.
>>> Seeking with AVSEEK_FLAG_ANY should work just fine.
>>> It might make sense to use that automatically for H.264 with
>>> sei_recovery_frame_cnt >= 0 (there seems no easy way to
>>> get this info out of FFmpeg. Well, except by inducing it
>>> from key_frame == 1 and frame_type != I I guess).
>> It should be quite easy to export sei_recovery_frame_cnt or something
>> like that by using codec specific options.
>> that is, patch welcome. (i could do it too but you have a usecase and
>> testcase for it ...)
> AVSEEK_FLAG_ANY does work so thats something. The only current detection I 
> believe is do the seek without this flag and then check for eof on read 
> packet. But that's bad since the first packet read is going to take 
> awhile.
> I think matroska only deals with keyframes for seeking (don't really 
> know), but I tried a few matroska files with AVSEEK_FLAG_ANY set for each 
> and that did not seem to cause any problem. Do you think it's ok to do 
> that for now for matroska files ?

It could also be if this condition was detected internal to ffmpeg and 
automatically set AVSEEK_FLAG_ANY if detected, then this would not need to 
be handled higher up. 

More information about the ffmpeg-devel mailing list