[Fwd: Re: [Theora-dev] Force keyframe creation]

David Barrett dbarrett at quinthar.com
Sat Aug 6 02:09:30 PDT 2005

(I think Timothy intended for this to go to the list; my apologies if it 

-------- Original Message --------
Subject: Re: [Theora-dev] Force keyframe creation
Date: Sat, 06 Aug 2005 00:06:32 -0400
From: Timothy B. Terriberry <tterribe at vt.edu>
To: David Barrett <dbarrett at quinthar.com>
References: <42F4186C.1050605 at quinthar.com>

David Barrett wrote:
> Is there any way to force the creation of a keyframe when encoding?
> Poking around through the archive it looks like I might be able to do
> this by setting 'keyframe_frequency_force' to '1' for a frame and then
> setting it back.  But to do this would I need to call
> 'theora_encode_init' again?  Is this safe?
> Basically, what's the best way to arbitrarily force the creation of a
> keyframe within an encoding session?

Calling it again (with a corresponding theora_clear first) would be
okay, except that it also resets the granule positions applied to the
packets. Not the end of the world, as you could fix those up yourself
before passing them on to the Ogg layer, but you'd have to know what
you're doing. There also may be some mucking around in the internal
theora state that would work, but you're on your own to figure out how
to do it (and be prepared for it to break later).

As an aside to others on the list, the theora-exp API has
theora_encode_ctl(), which could set this on the fly. Not saying that
that encoder is ready for public use yet, just the API.

More information about the Theora-dev mailing list