[theora-dev] ogg/theora decoder skipping frames

salsaman salsaman at gmail.com
Sat Nov 8 01:12:13 PST 2008


On Sat, Nov 8, 2008 at 5:05 AM, Conrad Parker <conrad at metadecks.org> wrote:

> 2008/11/6 salsaman <salsaman at gmail.com>:
> > Hi all,
> > I have been working on an ogg/theora demuxer/decoder plugin for LiVES
> > (http://lives.sourceforge.net). The decoder has a very simple interface,
> in
> > fact there are only two major functions: - a function to get details
> (frame
> > size, fps, palette, etc) from a URL; - a function to get a given frame
> from
> > a specified URL and copy the resulting frame into memory buffers.
> >
> > The code can be seen here:
> >
> >
> http://lives.cvs.sourceforge.net/viewvc/lives/lives-plugins/plugins/decoders/ogg_theora_decoder.c?view=log
> >
> > The function which is causing problems is get_frame(). Here the first
> pass
> > will seek to the keyframe before the target frame, then decode until we
> > reach the target frame, at which point the frame is output. The output is
> > done by way of ogg_data_process() which in turn calls ogg_theora_read().
> >
> > So far so good. However, on the second and subsequent frames, assuming we
> > are playing forwards sequentially, a shortcut is taken - at line 960:
> >
> > if
> >
> (tframe>last_frame&&((tframe-last_frame<=max_frame_diff||kframe==last_kframe)))
> > {
> >
> > here, tframe is our target frame, (static) last_frame is the last frame
> > output, and max_frame_diff is the keyframe skip / 2
> > If we are playing sequentially, then this shortcut will be taken - it
> sets
> > cont(inue) to TRUE and drops back into ogg_data_process(), and processing
> > should continue exactly where we left off last time. However what I see
> is
> > this - I am using 3 test clips. On one of the clips, playbck works
> > perfectly; however, on the other two clips, it looks like frames are
> being
> > skipped - the clip plays back too fast, with distortion, and we reach EOF
> > too soon.
> >
> > Maybe somebody can take a quick look at the code and tell me where I am
> > going wrong ?
>
> can you post links to the 3 files? it might be easier to debug if we
> can reproduce the problem, or at least look at the file contents.
> Also, does this happen when viewing any frame offsets in those files,
> or for particular frames?
>
> Conrad.
>


Hi Conrad,
thanks for your response. The file which does work is rather large (about
700MB) and exists only my local machine, given the file size and my slow
connection it is a bit difficult to upload it. The two files which don`t
work are a small test file with 17 frames (
http://www.xs4all.nl/~salsaman/testogg.ogg) and this file:
http://upload.wikimedia.org/wikipedia/commons/0/0c/Experience_ubuntu.ogg

If you have a Linux or BSD machine available, you can test out the player
code yourself:
download and install the CVS version of LiVES (see
http://lives.sf.net?do=cvs) and then go to File/Open and select one of the
files. The file will open up almost instantly (yay !) and clicking around
randomly on the timeline shows the correct frame. The problem can be seen
when playback is triggered.

To answer your question, the problem occurs no matter which frame is seeked
to as the start frame. Note also that there is visible distortion
(blockiness) during playback, indicating that frames are actually being
omitted rather than the file simply being played back too fast (which of
course I have checked for and eliminated the possibility of).

Regards,
Gabriel.
http://live.sf.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/theora-dev/attachments/20081108/e0d45bb8/attachment-0001.htm 


More information about the theora-dev mailing list