HTML |
---|
Comparisons |
HTML video is a subject of theHTML specification as the standard way of playing video via the web. Introduced inHTML5,[1] it is designed to partially replace theobject element and the previous de facto standard of using the proprietaryAdobe Flash plugin, though early adoption was hampered by lack of agreement as to whichvideo coding formats andaudio coding formats should be supported in web browsers. As of 2020, HTML video is the only widely supported video playback technology in modern browsers, with the Flash plugin being phased out.
The<video>
element started being discussed by theWHATWG in October 2006.[2] The<video>
element was proposed byOpera Software in February 2007.[3] Opera also released a preview build that was showcased the same day,[4][5] and a manifesto that called for video to become a first-class citizen of the web.[6]
The following HTML code fragment will embed aWebM video into a web page.
<videosrc="movie.webm"poster="movie.jpg"controls>This is fallback content to display for user agents that do not support the video tag.</video>
The "controls" attribute enables the browser's own user interface for controlling playback. Alternatively, playback can be controlled withJavaScript, which the web designer can use to create a custom user interface. The optional "poster" attribute specifies an image to show in the video's place before playback is started. Its purpose is to be representative of the video.
Video format support varies among browsers (see below), so a web page can provide video in multiple formats. For other features,browser sniffing is used sometimes, which may be error-prone: any web developer's knowledge of browsers will inevitably be incomplete or not up-to-date. The browser in question "knows best" what formats it can use. The "video" element supports fallback through specification of multiple sources. Using any number of <source> elements, as shown below, the browser will choose automatically which file to download. Alternatively, theJavaScriptcanPlayType() function can be used to achieve the same. The "type" attribute specifies theMIME type and possibly a list of codecs, which helps the browser to determine whether it can decode the file without beginning to download it. The MIME type denotes thecontainer format of the file, and the container format defines the interpretation of the codec string.[7]
<videoposter="poster.jpg"controls><sourcesrc="av1.mp4"type='video/mp4; codecs="av01.0.00M.08, opus"'><sourcesrc="avc.mp4"type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'><sourcesrc="vp9.webm"type='video/webm; codecs="vp9.0, opus"'><sourcesrc="theora.ogv"type='video/ogg; codecs="theora, vorbis"'><p>This is fallback content to display for user agents that do not support the video tag.</p></video>
The HTML specification does not specify which video and audio formats browsers should support. User agents are free to support any video formats they feel are appropriate, but content authors cannot assume that any video will be accessible by all complying user agents, since user agents have no minimal set of video and audio formats to support.
The HTML5 Working Group considered it desirable to specify at least one video format which all user agents (browsers) should support. The ideal format in this regard would:
Initially,OggTheora was the recommended standard video format in HTML5, because it was not affected by any known patents. But on 10 December 2007, the HTML5 specification was updated,[8] replacing the reference to concrete formats:
User agents should support Theora video and Vorbis audio, as well as the Ogg container format.
with a placeholder:[9]
It would be helpful for interoperability if all browsers could support the same codecs. However, there are no known codecs that satisfy all the current players: we need a codec that is known to not require per-unit or per-distributor licensing, that is compatible with the open source development model, that is of sufficient quality as to be usable, and that is not an additionalsubmarine patent risk for large companies. This is an ongoing issue and this section will be updated once more information is available.[10]
The result was a polarisation of HTML video betweenindustry-standard,ISO-defined butpatent-encumbered formats, andopen formats. The newAV1 format byAlliance for Open Media aims to be both industry standard, royalty-free, and open, and has wide industry support.
Although Theora is not affected by known non-free patents,Apple[11] has expressed concern aboutunknown patents that might affect it, whose owners might be waiting for a corporation with extensive financial resources to use the format before suing.[12][13] Formats likeH.264 might also be subject to unknown patents in principle, but they have been deployed much more widely and so it is presumed that any patent-holders would have already made themselves known.Apple has also opposed requiring Ogg format support in the HTML standard (even as a "should" requirement) on the grounds that some devices might support other formats much more easily, and that HTML has historically not required particular formats for anything.[13]
Someweb developers criticized the removal of the Ogg formats from the specification.[14] A follow-up discussion also occurred on the W3C questions and answers blog.[15]
Mozilla andOpera support only the open formats ofTheora andWebM. Google stated its intention to remove support for H.264 in 2011, specifically for the HTML video tag.[16] Although it has been removed fromChromium, as of January 2021[update] it has yet to be removed fromGoogle Chrome ten years later.[17][18]
The adaptive bitrate streaming standard MPEG-DASH can be used in Web browsers via theMedia Source Extensions (MSE)[19] and JavaScript-based DASH players. Such players are, e.g., the open-source project dash.js[19] of the DASH Industry Forum, but there are also products such as the HTML5 Video Player ofBitmovin[20] (using HTML with JavaScript, but also a Flash-based DASH players for legacy Web browsers not supporting the MSE).
Google's acquisition ofOn2 in 2010 resulted in its acquisition of theVP8 video format. Google has provided aroyalty-free license to use VP8.[21] Google also startedWebM, which combines the standardized open source VP8 video codec withVorbis audio in aMatroska based container. The opening of VP8 was welcomed by theFree Software Foundation.[22]
When Google announced in January 2011 that it would end native support of H.264 in Chrome,[23] criticism came from many quarters including Peter Bright ofArs Technica[24] and Microsoft web evangelist Tim Sneath, who compared Google's move to declaringEsperanto the official language of the United States.[25] However, Haavard Moen of Opera Software strongly criticized the Ars Technica article[26] and Google responded to the reaction by clarifying its intent to promote WebM in its products on the basis of openness.[16]
After the launch of WebM, Mozilla and Opera have called for the inclusion of VP8 in HTML.[27]
On 7 March 2013, Google Inc. andMPEG LA, LLC announced agreements covering techniques that "may be essential" to VP8, with Google receiving a license from MPEG LA and 11 patent holders, and MPEG LA ending its efforts to form a VP8 patent pool.[28][29][30][31]
In 2012,VP9 was released by Google as a successor to VP8, also open and royalty free.
At the end of 2017 the newAV1 format developed by theAlliance for Open Media (AOMedia) as the evolution of VP9 has reached the feature freeze, and the bitstream freeze is expected for January 2018. Firefox nightly builds already include support for AV1.[32]
H.264/MPEG-4 AVC is widely used, and has good speed, compression, hardware decoders, and video quality, but is patent-encumbered.[33] Users of H.264 need licenses either from the individual patent holders, or from theMPEG LA, a group of patent holders including Microsoft and Apple, except for some Internet broadcast video uses.[34] H.264 is usually used in the MP4 container format, together withAdvanced Audio Coding (AAC) audio. AAC is also covered by patents in itself, so users of MP4 will have to license both H.264 and AAC.
In June 2009, the WHATWG concluded that no existing format was suitable as a specified requirement.[35]
Apple still only supports H.264, but Microsoft now supportsVP9 and WebM, and has pledged support forAV1.
On 30 October 2013,Cisco announced that it was making a binary H.264 module available for download. Cisco will pay the costs of patent licensing for those binary moduleswhen downloaded by the using software while it is being installed, making H.264 free to use in that specific case.[36]
In the announcement, Cisco cited its desire of furthering the use of theWebRTC project as the reason, since WebRTC's video chat feature will benefit from having a video format supported in all browsers.[37] The H.264 module will be available on "all popular or feasibly supportable platforms, which can be loaded into any application".[38]
Cisco is also planning to publish source code for those modules underBSD license, but without paying the royalties,[36] so the code will practically befree software only in countries without H.264software patents, which has already been true about other existing implementations.
Also on 30 October 2013, Mozilla'sBrendan Eich announced that Firefox would automatically download Cisco's H.264 module when needed by default. He also noted that the binary module is not a perfect solution, since users do not have fullfree software rights to "modify, recompile, and redistribute without license agreements or fees". Thus Xiph and Mozilla continue the development ofDaala.[38][39]
OpenH264 only supports thebaseline profile of H.264, and does not by itself address the need for an AAC decoder. Therefore, it is not considered sufficient for typical MP4 web video, which is typically in thehigh profile with AAC audio.[40][41][42]However, for use in WebRTC, the omission of AAC was justified in the release announcement: "the standards bodies have aligned onOpus andG.711 as the common audio codecs for WebRTC".[37] There is doubt as to whether a capped global licensing of AAC, like Cisco's for H.264, is feasible after AAC's licensing bureau removed the price cap shortly after the release of OpenH264.[43]
This table shows which video formats arelikely to be supported by a givenuser agent. Most of the browsers listed here use amultimedia framework for decoding and display of video, instead of incorporating such software components. It is not generally possible to tell the set of formats supported by a multimedia framework without querying it, because that depends on theoperating system and third party codecs.[44] In these cases, video format support is an attribute of the framework, not the browser (or its layout engine), assuming the browser properly queries its multimedia framework before rejecting unknown video formats. In some cases, the support listed here is not a function of either codecs available within the operating system's underlying media framework, or of codec capabilities built into the browser, but rather could be by a browser add-on that might, for example, bypass the browser's normal HTML parsing of the <video> tag to embed a plug-in based video player.
Note that a video file normally contains both video and audio content, each encoded in its own format. The browser has to support both the video and audio formats. SeeHTML audio for a table of which audio formats are supported by each browser.
The video format can be specified byMIME type in HTML (seeexample). MIME types are used for querying multimedia frameworks for supported formats.[45]
Of these browsers, only Firefox and Opera employ libraries for built-in decoding. In practice, Internet Explorer and Safari can also guarantee certain format support, because their manufacturers also make their multimedia frameworks. At the other end of the scale, Konqueror has identical format support to Internet Explorer when run on Windows, and Safari when run on Mac, but the selected support here for Konqueror is the typical forLinux, where Konqueror has most of its users. In general, the format support of browsers is much dictated by conflicting interests of vendors, specifically thatMedia Foundation andQuickTime support commercial standards, whereasGStreamer andPhonon cannot legally support other than free formats by default on the free operating systems that they are intended for.[46]
Browser | Operating System | Theora (Ogg) | H.264 (MP4) | HEVC (MP4) | VP8 (WebM) | VP9 (WebM) | AV1 (WebM) |
---|---|---|---|---|---|---|---|
Android browser | Android | Since 2.3[47] | Since 3.0[47] | Since 5.0[47] | Since 2.3[47] | Since 4.4[47] | Since 10 |
Chromium | Unix-like and Windows | Since r18297[48] | ViaFFmpeg[49][50] | No[51] | Since r47759[52] | Since r172738[53] | Yes |
Google Chrome | Unix-like, Android, macOS, and Windows | Since 3.0[54][55] | Since 3.0[55][a] | Since 105 (software decoding; needs OS-level codecs) Since 107 (hardware decoding; needs hardware decoder) [57][58] | Since 6.0[59][60] | Since 29.0[b] | Since 70[63] |
Internet Explorer | Windows | ViaOpenCodecs | Since 9.0[64] | No[65] | ViaOpenCodecs | No | No |
Windows Phone | No | Since 9.0[66] | No | ||||
Windows RT | Since 10.0[66] | ||||||
Microsoft Edge | Unix-like, macOS and Windows (Chromium) | Since v79[67][68] | Since v79 (only browser to support DRM PlayReady)[67][69] | No[65] | Since v79[67][70] | Since v79[67][70] | Since v79[67] |
Windows 10 (Legacy EdgeHTML) | Since 17.0 (withWeb Media Extensions)[71][72][73] | Since 12.0[74] | Needs hardware decoder[c] | Since 17.0 (supports <video> tag withWeb Media Extensions andVP9 Video Extensions)[72] | Only enabled by default if hardware decoder present[77] Since 17.0 (supports <video> tag withWeb Media Extensions andVP9 Video Extensions)[71][72][73] | Since 18.0 (withAV1 Video Extension)[78] | |
Windows 10 Mobile | No | Since 13.0[79] | Since 15.0 (only viaMSE)[80] | Since 14.0 (only viaMSE)[81] | No | ||
Konqueror | Unix-like and Windows | Needs OS-level codecs[d] | |||||
Mozilla Firefox | Windows 7+ | Since 3.5[82] | Since 21.0[e] | No[65] | Since 4.0[85] | Since 28.0[86][87] | Since 65.0 (64-bit)[88] Since 66.0 (32-bit)[89] |
Windows Vista | Since 22.0[90] | ||||||
Windows XP and N editions | Since 46.0[91] | ||||||
Linux | 26.0 (viaGStreamer)[f] 43.0 (viaFFmpeg)[94] | Since 67.0[citation needed] | |||||
Android | Since 17.0[95] | in Nightly[citation needed] | |||||
macOS | Since 34.0[96] | Since 66.0[89] | |||||
Firefox OS | Since 1.1[97] | No | |||||
Opera Mobile | Android, iOS, Symbian, and Windows Mobile | Since 13.0 | Since 11.50 | No[98] | Since 15.0 | Since 16.0 | since 57.0[63] |
Opera | macOS, Windows | Since 10.50[99] | Since 24.0[100] | Since 10.60[101][102] | Yes | since 57.0[63] | |
Linux | Needs codec library[g] | ||||||
Safari | iOS | No | Since 3.1[104] | Since 11[105] | Since 17.4 (fully supported)[106] Since 12.1 (only viaWebRTC)[107] | Since 17.4 (fully supported)[106] Since 14 (only viaWebRTC)[108] | Since 17.0 (needs hardware decoder; needsMP4 container[citation needed])[109][h] |
macOS | ViaXiph QuickTime Components (macOS 10.11 and earlier) | Since 14.1[110] | Since 14.1[110] | ||||
GNOME Web | Linux and BSD | Needs OS-level codecs[i] |
These indicate the level of support for the given item in each engine. By default, the most recent version of the engine is implied. However, a specific version number can be listed; when this indicates full support, it's the initial version of the engine fully supporting the item.
Value | Meaning |
---|---|
Yes | Fully supported |
No | Has never been supported |
Partial | Only some values are supported |
Incorrect | Not implemented correctly in all cases |
Experimental | May be incomplete or buggy |
Nightly build | Currently in development; full support is expected |
Depends | Only supported for the specified conditions |
Dropped | No longer supported |
Transparent video, that is video with analpha channel, has multiple design advantages:[113]
transparent
[117] flag in its embedding code.HTML has support fordigital rights management (DRM, restricting how content can be used) via theEncrypted Media Extensions (EME). The addition of DRM is controversial because it allows restricting users' freedom to use media restricted by DRM, even where fair use gives users the legal right to do so.[118] A main argument in W3C's approval of EME was that the video content would otherwise be delivered in plugins and apps, and not in the web browser.[119]
In 2013Netflix added support for HTML video using EME, beside their old delivery method using aSilverlight plugin (also with DRM).[120]
In 2010, in the wake of AppleiPad launch and afterSteve Jobs announced thatApple mobile devices would not support Flash, a number of high-profile sites began to serve H.264 HTML video instead ofAdobe Flash for user-agents identifying as iPad.[121] HTML video was not as widespread as Flash videos, though there were rollouts of experimental HTML-based video players fromDailyMotion (using Ogg Theora and Vorbis format),[122] YouTube (using the H.264 and WebM formats),[123] and Vimeo (using the H.264 format).[124]
Support for HTML video has been steadily increasing. In June 2013, Netflix added support for HTML video.[125] In January 2015, YouTube switched to using HTML video instead of Flash by default.[126] In December 2015, Facebook switched from Flash to HTML video for all video content.[127]
As of 2016, Flash is still widely installed on desktops, while generally not being supported on mobile devices such as smartphones.[128] The Flash plugin is widely assumed, including by Adobe,[128][129] to be destined to be phased out,[130][131] which will leave HTML video as the only widely supported method to play video on the World Wide Web. Chrome,[132][133] Firefox,[134] Safari,[135] and Edge,[136] have plans to make almost all flash content click to play in 2017. The only major browser which does not have announced plans to deprecate Flash is Internet Explorer.[137] Adobe announced on 25 July 2017 that they would be permanently ending development of Flash in 2020.[138]
A video element is used for playing videos or movies.
{{cite web}}
: CS1 maint: archived copy as title (link)This blog showcases various use cases of transparent videos in web design, besides advertising their own software product, Rotato.
Chrome 31 now supports video alpha transparency in WebM. In other words, Chrome takes the alpha channel into account when playing green screen videos encoded to WebM (VP8 and VP9) with an alpha channel. This means you can play videos with transparent backgrounds: over web pages, images or even other videos.
The background color (Stage color) of a SWF file can be set to transparent. The background color or image of the HTML page that contains the SWF file shows through. This technique allows layering of SWF content with DHTML (Dynamic HTML) content. Not every web browser handles transparency in the same way. Be sure to test your SWF file in all browsers that you want to enable your audience to use. Most Linux browsers do not support Animate transparency.
transparent — The SWF content is layered together with other HTML elements on the page. The SWF file background color (Stage color) is transparent. HTML elements beneath the SWF file are visible through any transparent areas of the SWF, with alpha blending. This option reduces playback performance compared to wmode=window or wmode=direct.