[whatwg] Video element and duration attribute

On Sat, 1 Nov 2008, Chris Double wrote:
>
> Some video formats don't make it easy to get the duration.

Indeed.


> 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?

It seems like a bad idea, since if we do this we'd have to define all 
kinds of error handling for when the author says the clip is 60 seconds 
long and then seeks to second 50 when the clip is really 40 seconds long, 
etc.


On Thu, 6 Nov 2008, Eric Carlson wrote:
>
> 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.

Agreed.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Sunday, 16 November 2008 16:23:31 UTC