|
December 25th, 2009 | #1 |
Senior Member
Join Date: Jan 2007
Posts: 1,670
|
Configuring web servers for HTML5 Ogg video and audio
1. Serve X-Content-Duration headers
The Ogg format doesn't encapsulate the duration of the media. So for the progress bar on the video controls to display the duration of the video, we need to somehow determine the duration. You can either support HTTP1.1 Byte-Range requests (see 2. below) or better yet, serve an X-Content-Duration header for your Ogg videos. This provides the duration of the video in seconds (not HH:MM:SS format), as a floating point value. For example, a video which is 1 minute and 32.6 seconds would you'd serve the extra header: "X-Content-Duration: 92.6". When an Firefox requests an Ogg media, if you should serve up the X-Content-Duration header with the duration of the media. This means Firefox doesn't need to do any extra HTTP requests to seek to the end of the file to calculate the duration so it can display the progress bar. You can get the duration using oggz-info, which comes with oggz-tools. oggz-info gives output like this: $ oggz-info /g/media/bruce_vs_ironman.ogv Content-Duration: 00:01:00.046 Skeleton: serialno 1976223438 4 packets in 3 pages, 1.3 packets/page, 27.508% Ogg overhead Presentation-Time: 0.000 Basetime: 0.000 Theora: serialno 0170995062 1790 packets in 1068 pages, 1.7 packets/page, 1.049% Ogg overhead Video-Framerate: 29.983 fps Video-Width: 640 Video-Height: 360 Vorbis: serialno 0708996688 4531 packets in 167 pages, 27.1 packets/page, 1.408% Ogg overhead Audio-Samplerate: 44100 Hz Audio-Channels: 2 Note that you can't just serve up the Content-Duration line that oggz-info outputs, it's in HH:MM:SS.ss format, you need to convert it to seconds only, and serve it as X-Content-Duration. Be warned, it looks like oggz-info makes one read pass of the media in order to calculate the duration, so it would be wise to store the duration value, and not to calculate it for every HTTP request of every Ogg video. .ogv .
__________________
Красным цветом в России будет цвет коммунистических еврейств . |
Share |
Thread | |
Display Modes | |
|