--- title: Media formats supported by the HTML audio and video elements slug: conflicting/Web/Media/Formats translation_of: Web/Media/Formats translation_of_original: Web/HTML/Supported_media_formats original_slug: Web/HTML/Supported_media_formats ---
The {{ HTMLElement("audio") }} and {{ HTMLElement("video") }} elements provide support for playing audio and video media without requiring plug-ins. Video codecs and audio codecs are used to handle video and audio, and different codecs offer different levels of compression and quality. A container format is used to store and transmit the coded video and audio (both together, the case of a video with a soundtrack). Many combinations of codecs and container formats exist, although only a handful of these are relevant on the Web.
Different browsers do not support the same media formats in their implementations of HTML5 video and audio, mainly because of patent issues. The area of media formats on the Web has greatly suffered from patent law in many countries - including the USA and EU countries (the notes on patents in this article is provided as-is and without any warranty.) This article discusses the different codec and container combinations relevant to the web, including support in browsers on both desktop and other device types.
To make an HTML5 video, which works in the newest versions of all major browsers, you can serve your video in both WebM format and MPEG H.264 AAC format, using the source
element like this:
<video controls> <source src="somevideo.webm" type="video/webm"> <source src="somevideo.mp4" type="video/mp4"> I'm sorry; your browser doesn't support HTML5 video in WebM with VP8 or MP4 with H.264. <!-- You can embed a Flash player here, to play your mp4 video in older browsers --> </video>
The WebM format is based on a restricted version of the Matroska container format. It always uses the VP8 or VP9 video codec and the Vorbis or Opus audio codec. WebM is natively supported in desktop and mobile Gecko (Firefox), Chrome and Opera, and support for the format can be added to Internet Explorer and Safari (but not on iOS) by installing an add-on.
Statement from Microsoft on why IE9 does not have native WebM support.
The WebM format, specifically the VP8 video codec, had been acccused of patent infringment by a group of companies answering a call by the MPEG LA for the formation of a patent pool, but MPEG LA has agreed to license those patents to Google under a "perpetual, transferable, royalty free license". This means, effectively, that all known patents on the WebM format are licensed to everyone for free.
Gecko recognizes the following MIME types as WebM files:
video/webm
audio/webm
The Ogg container format with the Theora video codec and the Vorbis audio codec is supported in desktop/mobile Gecko (Firefox), Chrome, and Opera, and support for the format can be added to Safari (but not on iOS) by installing an add-on. The format is not supported in Internet Explorer in any way.
WebM is generally preferred over Ogg Theora Vorbis when available, because it provides a better compression to quality ratio and is supported in more browsers. The Ogg format can however be used to support older browser versions (for example Firefox 3.5/3.6 don't support WebM, but do support Ogg.)
The patent situation of Theora is similar to that of WebM.
You can learn more about creating Ogg media by reading the Theora Cookbook.
Gecko recognizes the following MIME types as Ogg files:
audio/ogg
video/ogg
application/ogg
The Ogg container can also contain audio encoded using the Opus codec. Support for this is available in Gecko 15.0 {{ geckoRelease("15.0") }} and later, on desktop and mobile browsers.
The MP4 container format with the H.264 video codec and the AAC audio codec is natively supported by desktop/mobile Internet Explorer, Safari and Chrome, but Chromium and Opera do not support the format. IE and Chrome also support the MP3 audio codec in the MP4 container, but Safari does not. Firefox/Firefox for Android/Firefox OS supports the format in some cases, but only when a third-party decoder is available, and the device hardware can handle the profile used to encode the MP4.
Note: MP4s encoded with a high profile will not run on lower end hardware, such as low end Firefox OS phones.
The MPEG media formats are covered by patents, which are not freely licensed. All the necessary licenses can be bought from MPEG LA. Since H.264 is currently not a royalty free format, it is unfit for the open web platform, according to Mozilla [1, 2], Google [1, 2] and Opera. However, since royalty free formats are not supported by Internet Explorer and Safari, Mozilla has decided to support the format anyway, and Google never fulfilled their promise to remove support for it in Chrome.
The MP3 audio format (.mp3, audio/mpeg
; distinct from the above MP3 audio in an MP4 container case) is supported in <audio>
by Firefox/Firefox for Android/Firefox OS when the operating system provides an MP3 decoder, and by Internet Explorer, Chrome and Safari.
The WAVE container format, with the PCM audio codec (WAVE codec "1") is supported by desktop/mobile Gecko (Firefox) and Safari. Files in the WAVE container format typically end with the ".wav" extension.
Gecko recognizes the following MIME types as WAVE audio files:
audio/wave
(preferred)audio/wav
audio/x-wav
audio/x-pn-wav
{{ CompatibilityTable() }}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 3.0 | {{ CompatGeckoDesktop("1.9.1") }} | 9.0 | 10.50 | 3.1 |
<audio> : PCM in WAVE |
{{ CompatVersionUnknown() }} | {{ CompatGeckoDesktop("1.9.1") }} | {{ CompatNo() }} | 10.50 | 3.1 |
<audio> : Vorbis in WebM |
{{ CompatVersionUnknown() }} | {{ CompatGeckoDesktop("2.0") }} | {{ CompatNo() }} | 10.60 | 3.1 (must be installed separately) |
<audio> : Vorbis in Ogg |
{{ CompatVersionUnknown() }} | {{ CompatGeckoDesktop("1.9.1") }} | {{ CompatNo() }} | 10.50 | 3.1 (must be installed separately, e.g. XiphQT) |
<audio>: MP3 | {{ CompatVersionUnknown() }} (Not in Chromium) | Partial (see below) | 9.0 | {{ CompatNo() }} | 3.1 |
<audio> : MP3 in MP4 |
{{ CompatUnknown() }} |
{{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
<audio> : AAC in MP4 |
{{ CompatVersionUnknown() }} (Main only) (Not in Chromium) |
Partial (see below) |
9.0 | {{ CompatNo() }} | 3.1 |
<audio> : Opus in Ogg |
27.0 | {{ CompatGeckoDesktop("15.0") }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
<video> : VP8 and Vorbis in WebM |
6.0 | {{ CompatGeckoDesktop("2.0") }} | 9.0 (must be installed separately, e.g. WebM MF) | 10.60 | 3.1 (must be installed separately, e.g. Perian) |
<video> : VP9 and Opus in WebM |
29.0 | {{ CompatGeckoDesktop("28.0") }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
<video> : Theora and Vorbis in Ogg |
{{ CompatVersionUnknown() }} | {{ CompatGeckoDesktop("1.9.1") }} | {{ CompatNo() }} | 10.50 | 3.1 (must be installed separately, e.g. XiphQT) |
<video> : H.264 and MP3 in MP4 |
{{ CompatVersionUnknown() }} (Not in Chromium) |
Partial (see below) | 9.0 | {{ CompatNo() }} | {{ CompatNo() }} |
<video> : H.264 and AAC in MP4 |
{{ CompatVersionUnknown() }} (Not in Chromium) |
Partial (see below) | 9.0 | {{ CompatNo() }} | 3.1 |
any other format | {{ CompatNo() }} | {{ CompatNo() }} | {{ CompatNo() }} | {{ CompatNo() }} | 3.1 (plays all formats available via QuickTime) |
Feature | Android | Firefox Mobile (Gecko) | Firefox OS (Gecko) | IE Mobile | Opera Mobile | Opera Mini | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | 2.3 | 24.0 | 1.0.1 | 10.0 | 11.0 | Partial (see below) | 3.2 | 29.0 |
<audio> : PCM in WAVE |
{{ CompatUnknown() }} | 24.0 | 1.0.1 | {{ CompatNo() }} | {{ CompatNo() }} | Partial (see below) | 3.2 | {{ CompatUnknown() }} |
<audio> : Vorbis in WebM |
{{ CompatUnknown() }} | 24.0 | 1.0.1 | {{ CompatNo() }} | 11.0 | Partial (see below) | {{ CompatNo() }} | {{ CompatUnknown() }} |
<audio> : Vorbis in Ogg |
{{ CompatUnknown() }} | 24.0 | 1.0.1 | {{ CompatNo() }} | 11.0 | Partial (see below) | {{ CompatNo() }} | {{ CompatUnknown() }} |
<audio> : MP3 |
{{ CompatUnknown() }} | Partial (see below) | Partial (see below) | 10.0 | {{ CompatNo() }} | Partial (see below) | 3.2 | {{ CompatUnknown() }} |
<audio> : MP3 in MP4 |
{{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
<audio> : AAC in MP4 |
{{ CompatUnknown() }} | Partial (see below) | Partial (see below) | 10.0 | {{ CompatNo() }} | Partial (see below) | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
<audio> : Opus in Ogg |
{{ CompatNo() }} | 24.0 | {{ CompatNo() }} | {{ CompatNo() }} | {{ CompatNo() }} | Partial (see below) | {{ CompatNo() }} | {{ CompatNo() }} |
<video> : VP8 and Vorbis in WebM |
2.3 | 24.0 | 1.0.1 | {{ CompatNo() }} | 16.0 | Partial (see below) | {{ CompatNo() }} | 29.0 |
<video> : VP9 and Opus in WebM |
{{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
<video> : Theora and Vorbis in Ogg |
{{ CompatNo() }} | 24.0 | 1.0.1 | {{ CompatNo() }} | {{ CompatNo() }} | Partial (see below) | {{ CompatNo() }} | {{ CompatNo() }} |
<video> : H.264 and MP3 in MP4 |
Partial (see below) | 24.0 | Partial (see below) | 10.0 | Partial since 11.0, full since 16.0 | Partial (see below) | {{ CompatUnknown() }} | 29.0 |
<video> : H.264 and AAC in MP4 |
Partial (see below) | 24.0 | Partial (see below) | 10.0 | Partial since 11.0, full since 16.0 | Partial (see below) | 3.2 | 29.0 |
any other format | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
Notes:
<video>
support for different formats, HTMLMediaElement.prototype.canPlayType
incorrectly reports true
for h.264 video whereas in actual fact h.264 is not supported. In Firefox OS 1.1 this problem has been fixed.Platform | Gecko (Firefox) version |
---|---|
Windows 7+ | 21.0 |
Windows Vista | 22.0 |
Android | 20.0 |
Firefox OS | 15.0 |
Linux |
26.0 (relies on GStreamer codecs being installed) |
OS X 10.7 | Not yet (see bug) |
video
audio