(I think Timothy intended for this to go to the list; my apologies if it
wasn't.)
-------- Original Message --------
Subject: Re: [Theora-dev] Force keyframe creation
Date: Sat, 06 Aug 2005 00:06:32 -0400
From: Timothy B. Terriberry <tterribe@vt.edu>
To: David Barrett <dbarrett@quinthar.com>
References: <42F4186C.1050605@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.