[Ffmpeg-devel] Compilation with --enable-theora fails

Keenan Pepper keenanpepper
Wed May 11 19:24:34 CEST 2005


Rich Felker wrote:
> When you say the frame number of the keyframe, do you mean just
> counting keyframes, or counting all frames? BTW this is the most
> incredibly idiotic thing I've ever heard of.. is it just an ugly hack
> to make up for the lack of a keyframe flag and index?

It's not idiotic! Ogg is a really low-level, general purpose stream 
container. Ogg couldn't care less about keyframes or even units of time, 
all Ogg needs is a monotonically increasing granulepos, and the way 
theora does it is clean and simple. BTW libtheora _already has_ a 
function to get the time from the granulepos, so it's pointless to 
reimplement it in ffmpeg. Here is all the math:

   if(granulepos>=0){
     ogg_int64_t iframe=granulepos>>pbi->keyframe_granule_shift;
     ogg_int64_t pframe=granulepos-(iframe<<pbi->keyframe_granule_shift);

     return (iframe+pframe)*
       ((double)pbi->info.fps_denominator/pbi->info.fps_numerator);





More information about the ffmpeg-devel mailing list