开发者

What are all the formats of video supported by html5?

I am trying to develop a simple webpage with all the newly added basic elements of html5. While working with the video tag, I see that some formats like .avi are not supported.

So is there a list of video formats supported by html5?

Even if a particular format like WebM/ogg is sup开发者_运维问答ported by html5, is it safe enough to presume that the browser used will be capable to display the video?


There is no universally supported format (yet) unfortunately. Technically, HTML5 doesn't support any video formats, it's the browsers themselves that support specific video formats. This has led to a giant mess.

You can find a list of format compatibility on Wikipedia. From that, VP8/WebM is likely your best bet if you only want to support a single format. Luckily the <video> tag does support fallbacks if providing more than one encoding is feasible for your uses, in which case a VP8/WebM version combined with a H.264 version covers every major browser.

For multiple versions of the same video, you can use the following code:

<video width="320" height="240">
  <source src="myvideo.mp4" type="video/mp4" />
  <source src="myvideo.ogv" type="video/ogg" />
  <source src="myvideo.webm" type="video/webm" />
  <p>Other backup content, eg. a flash version, should go here.</p>
</video>


There doesn't seem to be a single video format that is supported on all HTML5 capable browsers today. There's basically two formats that compete over being the one:

WebM - Supported by Firefox, Opera, Chrome, IE9 (with plugin)

H.264 - Supported by Safari and IE 9

So at the time, I think you'll basically has to provide the video in two formats and guess the browser to feed it the correct one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜