HTML5 Guidelines for Web Developers

(coco) #1
4.3 Video Codecs 73

can manage perfectly. A complete example for displaying a video in reduced size
based on media queries looks like this:


<!DOCTYPE html>


Simple Video

Browsers with less than 500 pixels in width for displaying the video will auto-
matically display the smaller video format mvi_2170_qvga.webm.


The specification of CSS3 Media Queries is currently in the Editors Draft stage.
Some details are therefore likely to change. You can look up the current stage of the
specification on the W3C website at http://dev.w3.org/csswg/css3-mediaqueries.

The second criterion for determining which video will be displayed is the MIME
type. The optional addition of the codecs used lets the browser recognize, even
before loading, whether the video can be decoded. But what are these codecs
about? The following section attempts to shed light on the codec jungle.


4.3 Video Codecs


Modern video formats use a container file where audio and video contents can
be saved separately. This flexible approach has several advantages. For example,
several audio tracks can be saved in one file, allowing the user to switch between
languages (as you would on a video DVD). Figure 4.2 shows the schematic rep-
resentation of a video container file. The way in which audio and video are com-
pressed within this container file is referred to as codec.


NOTE
Free download pdf