Video codecs for HTML 5
H.264, WebM, Ogg, three codecs are implemented for the <video> tag , but not right on all browsers. Actually it is difficult for browser maker to choose a codec as reported by W3C.
The free Ogg Theora video format is now recognized by Firefox, Opera and Chrome.
WebM is actually intended to supplant it as offering better picture quality. It is recognized by all browsers.
H.264 is recognized by Chrome and Safari, not by Firefox or Opera due to licensing fees.
WebM and Ogg are not subject to any patent in contrast to H.264. In fact Google has signed a agreement with patent holders of H.264 so that no one can be sued (in the U.S.) for patents possibly involved in VP8, the video format of WebM .
Even if the involved firms (mainly Google, Apple and Mozilla) have not reached agreement on a standard video format for HTML 5, ogg is recognized by the video tag and using it is very simple, with a such code:
<video src="video.ogv"></video>
This is for a file stored locally on the site.
The file extension is sufficient to identify the format. To use a video from a sharing site, add this code:
<video src="https://www.youtube.com/video.ogv"></video>
This better replaces all the code of the flash player and allows to use additional functions with this tag. For example:
<video src="video.ogv" width="600" height="400" autoplay> Your browser does not support the video tag.</ video>
It is always possible to place the code in flash instead of the message between the tags for the browser does not support HTML 5. This can be done dynamically.
The Theora manual provides further details on the use of the format. Theora is the level of the H.263 codec and is widely surpassed in quality by new formats.
Site and tools for Ogg
These sites host videos in Ogg format: Dailymotion, Archive.org.
Google is particularly concerned by the codec associated with the video tag as it holds the main platform for video, Youtube. Which has a section for HTML 5 in the subdirectory /html5/.
So it bought the VP8 codec to On2 Technologies in 2010 and made it open source and free to use.
The codec has a Matroska container, such as Ogg has Theora. The codec for <audio> tag is called Vorbis.
Plugins are available for IE and Safari, other browsers do not need that, any more than software like VLC and Miro.
Code sample:
<video src="video.webm"> </ video>
- WebM. The site.
- Youtube and HTML 5. About the support on browsers.
The H.264 format supported by Apple and Microsoft, which are among the beneficiaries, is widely used in the world of video.
But use is not free in most cases which resteint its implementation in browsers.
It is found a slight advantage over WebM for the quality of the image but it would rely to implementation more than the format, and implementation can improve over time.
Its successor H.265 is encumbered by many patents that make it difficult to popularize.
As an alternative to H.265, Cisco, which had already allowed the use of H.264 without royalty, has launched a new codec, with the participation of specialists of the video encoding and lawyers to avoid patents problems. Thor is completely free and open source.
Cisco in this case must use significant resources to prevent reuse of principles already implemented, making questions about the real utility of patents!
- Thor. On GitHub. Use the thorenc command to encode a video in the new format.