[FFmpeg-devel] seeking bug in theora codec libavcodec/vp3.c ?

David Conrad lessen42
Mon Dec 1 00:46:45 CET 2008

On Nov 30, 2008, at 5:06 PM, Chris Stones wrote:

> Hello,
>  As you may be aware, ffmpeg is unable to correctly seek Theora video.
> Attempting to seek (even to frame 0) shows only the moving parts of  
> the
> first few seconds, with static areas of the scene showing the  
> contents of
> the frame prior to seeking.
> After a short while (presumably when a keyframe is hit) the video  
> picture
> becomes perfect again.
> Am I correct in thinking these artefacts are occurring because the  
> player
> has seeked to an intermediate frame, instead of a keyframe ???

Yes. I'm assuming you're playing Theora in ogg; I'm not aware of  
seeking problems involving Theora in any other container (e.g. mkv).

> The Theora codec is stil using the the old pre 1.0 theora_* api, is  
> nobody
> activly maintining libabcodev/vp3.c ?

Are you looking at libtheoraenc.c? That's only used for encoding Theora.

> I intend to correct this problem, any pointers on where to start ?
> I notice that the "flush" field of AVCodec is set to NULL, is this  
> likely to
> be the cause of the seeking artifacts ?

As far as I'm aware, flush is only used as a signal that there will be  
a known discontinuity in frames being sent to the decoder and mainly  
matters for codecs that do frame reordering (Theora doesn't.) At any  
rate it won't fix the problem that decoding doesn't start on a  
keyframe after a seek in ogg.

The correct place to fix this is in oggdec.c. I've been looking at  
this but I haven't liked what I've come up with so far.

> Where is seeking implemented, it does not seem to be codec  
> specific.. i
> assume it is container specific ?

Yes, seeking is completely independent of codec in nearly all  
containers. ogg is the only exception I'm aware of.

More information about the ffmpeg-devel mailing list