Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are all the formats of video supported by html5?

Tags:

html

video

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 supported by html5, is it safe enough to presume that the browser used will be capable to display the video?

like image 233
Vamsi Emani Avatar asked Sep 13 '25 10:09

Vamsi Emani


1 Answers

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>
like image 182
Matthew Scharley Avatar answered Sep 16 '25 03:09

Matthew Scharley