HTML and CSS Reference
Encoding royalty-free video and audio
Ideally, you should start the conversion from the source format itself, rather than recompressing an already
compressed version which reduces the quality of the final output. If you already have a web-optimised,
tightly compressed MP4/H.264 version, don't convert that one to WebM/VP8, but rather go back to your
original footage and recompress that if possible.
For audio, the open-source audio editing software Audacity ( http://audacity.sourceforge.net/ ) has built-in
support for Ogg Vorbis export.
For video conversion, there are a few good choices. For WebM, there are only a few encoders at the
moment, unsurprisingly for such a new codec. See www.webmproject.org/tools/ for the growing list.
com ), which allows you to drag a file into its window for conversion into WebM, Theora, or H.264 opti-
mised for different devices such as iPhone, Android Nexus One, PS2, and so on.
For those developers who are not afraid by a bit of command-line work, the open-source FFmpeg library
( http://fmpeg.org ) is the big beast of converters. $ ffmpeg -i video.avi video.webm is all you need.
The conversion process can also be automated and handled server-side. For instance, in a CMS environ-
ment, you may be unable to control the format in which authors upload their files, so you may want to do
compression at the server end. ffmpeg can be installed on a server to bring industrial-strength conversions
of uploaded files (maybe you're starting your own YouTube killer?).
If you're worried about storage space and you're happy to share your media files (audio and video) under
one of the various CC licenses, have a look at the Internet Archive ( www.archive.org/create/ ) , which will
convert and host them for you. Just create a password and upload, and then use a <video> element on
your page but link to the source file on their servers.
Another option for third-party conversion and hosting is vid.ly. The free service allows you to upload any
video up to 2GB via the website, after which they will convert it. When your users come to the site, they
will be served a codec their browser understands, even on mobile phones.
Sending differently compressed
videos to handheld devices
Video files tend to be large, and sending very high-quality video
can be wasteful if sent to handheld devices where the small
screen sizes make high quality unnecessary. There's no point in
sending high-definition video meant for a widescreen monitor
to a handheld device screen, and most users of smartphones
and tablets will gladly compromise a little bit on encoding qual-
ity if it means that the video will actually load over a mobile