- From: Eric Carlson <eric.carlson@apple.com>
- Date: Thu, 06 Nov 2008 09:46:45 -0800
Chris - On Oct 31, 2008, at 1:18 PM, Chris Double wrote: > Some video formats don't make it easy to get the duration. > > For example, Ogg files can be concatenated to form a single playable > file. To compute the duration you need to do multiple seeks to find > the chains and total the durations of each chain. Even in the > unchained case a seek is required to go to the end of the file and > work backwards finding a packet with a timestamp. While this is not > difficult to implement it can be expensive over HTTP, requiring > multiple byte range requests. > > The most common player for Ogg files on the web is probably the > Cortado Java applet, and it has an applet parameter to specify the > duration. There have been requests in #theora from people wishing that > <video> supported a duration attribute that could be set in the HTML. > > Would such an attribute be useful? It seems to be a commonly used in > current Ogg web solutions. Are there any other video formats that > could benefit from this? > There are other audio and video formats that require a file's duration to be computed, eg. an MP3 file without an "MPEG audio frames" packet or a muxed MPEG stream, but I don't think including a "duration" attribute is necessary. Instead of seeking to the end of the file to calculate an exact duration as you describe, it is much cheaper to estimate the duration by processing a fixed portion of the file and extrapolating to the duration based on the file size. QuickTime does this and it works quite well. An estimate may not be correct, but the spec requires a user agent to post a "durationchange" event for exactly this case. If we have a "duration" attribute a user agent will still have to deal with pages that don't include it, or that include a value that is wildly inaccurate (copy/paste editing?), so I think it makes more sense for the user agent/media engine to just figure it out. eric
Received on Thursday, 6 November 2008 09:46:45 UTC