HTML and CSS Reference
Before discussing how to embed video within a web page, it's important to discuss video
formats. All video files are compressed using what's known as a codec, short for
coder/decoder. After a video has been encoded, it must be saved within a container file,
and just as there are a number of codecs, there are a number of container file formats,
too. To play a video, an application must understand how to deal with its container file
and decode whatever codec was used to compress the video. For example, H.264 is one
of the most popular video codecs and is supported by a number of container formats,
including FLV (Flash Video) and MP4.
It's not uncommon to run into situations where a video player can open the container file
used to package the video but does not support the codec used to encode the video.
Likewise, if a video player doesn't recognize the container file used to package the
video, it won't play it back, regardless of the codec used. Whereas many, many video
codes and container formats exist, only a few are relevant in terms of video on the Web.
The extension for a video file indicates its container format, not the codec of the video in
it. For example, the extension for Apple's QuickTime container format is .mov , regard-
less of which codec is used to encode the video.
H.264 is a commercial format that is supported natively by Microsoft Internet Explorer 9,
Apple Safari, and Google Chrome. It's also supported by Flash. The problem with H.264
is that it is patented, and there are license fees associated with the patents. Companies
that implement the codec must pay for a license as must companies that use the codec to
deliver H.264 video to users. Mozilla has decided not to support H.264 in Firefox
because of the patent licenses required. H.264 is the most popular format for delivering
video content over the Web by far. It's also used for satellite and cable television and to
encode the video on Blu-ray discs.
Most commonly, H.264 video is associated with MP4 ( .mp4 ) containers or occasionally
Flash Video ( .flv ) containers. MP4 files are supported by the Flash player and by all the
browsers that support H.264 video, making it the most widely supported container for
distributing video on the Web.
Theora is an open, freely licensed video codec released by the Xiph.org Foundation.
Mozilla Firefox and Google Chrome offer Theora support, but Apple and Microsoft have
no plans to support it. It's usually associated with the Ogg container format, and the files
are usually referred to as Ogg Theora files. Ogg files that contain video usually have the
extension .ogv . There's also an associated audio codec, Vorbis. Ogg Theora files have
the extension .oga .