[FFmpeg-devel] [PATCH] Incorrect Ogg Theora duration

Baptiste Coudurier baptiste.coudurier
Fri Apr 18 09:45:37 CEST 2008

Henrik Gulbrandsen wrote:
> This problem showed up when I was getting ready to deliver my next patch
> yesterday. In effect, the duration calculation for Ogg streams seems to
> drop the first and last frame. This would be true for all Ogg data, but
> it's only noticeable for video at a low frame rate.
> The attached examples show the result of
>     ffmpeg -i video.mp4 -vcodec libtheora -f ogg video.ogv
>     ffplay -stats video.ogv > report.txt 2>&1
> before and after the patch. Here, video.mp4 is exactly 24 seconds long,
> at 10 fps. Notice the "Duration: 00:00:23.80, start: 0.100000" part in
> the stats given with current code!
> /Henrik
> P.S. The "granule + 1" part of the patch is not technically correct, but
> should work for Theora, Vorbis, FLAC, and Speex, since none of them use
> overly complex semantics for the granule position. A more correct way of
> handling it would require extra code in each of the supported codecs...

I think the "start" value is incorrect. According to specs, ogg granule 
stores the pts plus the duration of the ogg packet, so last packet 
granule is the stream duration.

Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG SAS                                     http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312

More information about the ffmpeg-devel mailing list