[FFmpeg-devel] [PATCH] Fix potential infinite discard loop.

Don Moir donmoir at comcast.net
Sun Feb 5 18:21:53 CET 2012


> On Sat, Feb 04, 2012 at 07:32:25PM -0500, Don Moir wrote:
>> file 1 ) 
>> http://sms.pangolin.com/temp/bad_seek_os-keyframe_Wiki_feel_stupid.ogv
>
> The file as far as I can tell is broken.
> The granule values indicate all frames before the one it ends up
> seeking to as non-keyframes.
> The reason why it works if you always reset keyframe_seek to 0 is
> because the auto-generated index contains that position marked as
> keyframe, since that value is based on the VP3 header parser and
> not the data from the muxing level.
>
>> I also have not seen a case where setting os->keyframe back to zero
>> causes any problem (tested about 40-50 ogg files). It might be that
>> it just needs to be put back into the state it was in prior to
>> calling ff_seek_frame_binary. don't know.
>
> No, it behaves exactly as intended, since in that case it
> knows that a keyframe is around that position it discards
> everything up to that keyframe.
> The problem is just that the first frame is marked as _not_
> being a keyframe.
> My personal recommendation is to just give up on Ogg, it is
> such an incredibly crappy, badly designed, limited, needlessly
> complex and generally broken format. Really like someone on
> purpose thought "what would be the worst way to implement it"
> on every step.

I almost canned ogg a couple times as it seemed bad and was not sure about 
how often it was being used. I see that archive.org is using it for almost 
all their videos. They generally offer the videos in MPEG4 and ogg. My 
thinking is if the format plays reasonable well then accept it and ogg files 
have always played well for me. It was just when I got into seeking on them, 
I ran into some problems. With your patches and/or manually creating the 
index_entries, seeking also works well outside of the os->keyframe issue for 
some files. Also, since ffmpeg attempts to play back any reasonable format, 
then I think if a format is put into ffmpeg, all effort should be made to 
make it work properly, otherwise, it should not be put in to ffmpeg.

There is some percentage of the files that have the problem when 
os->keyframe is not set to zero. I don't seem to have a problem finding 
them. The seektest.ogv file on ticket #438 also has this problem but it's 
very minimal compared to the above which is just about the worse case of it. 
I have several others that produce no errors etc, but just fail the seek 
when os->keyframe is not zeroed. They seek, just the video lags behind but 
audio is right on.

By the way, Windows Media Player plays the above file fine and the seek is 
perfect on it. It's using ffdshow libavcodec.

Do you have a case where setting os->keyframe to zero after a seek fails ? 



More information about the ffmpeg-devel mailing list