Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is a complete list of MIME types with codecs for the HTML5 source attribute?

The HTML 5 source element has a src and a type attribute, like this:

<source src='url' type='mime/type; codec="codec-name"' />

Where is a complete list of the MIME types for the type attribute, together with their corresponding valid codecs attribute values?

like image 520
HELP Avatar asked Apr 15 '11 05:04

HELP


1 Answers

There is a great list of MIME types and their browser support along with the codecs at WHATWG Wiki.

The most common codecs used and supported for HTML5 video are:

  • WebM: audio/webm, video/webm
  • OGG: application/ogg, audio/oggm, video/ogg
  • H.264 or MP4: audio/mp4m, video/mp4

So, you can set the <source> for your video to read:

  • <source src="video.ogv" type='video/ogg; codecs="theora, vorbis"'>
  • <source src="video.webm" type='video/webm; codecs="vp8, vorbis"'>
  • <source src="video.mp4" type='video/mp4; codecs="vc1.42E01E, mp4a.40.2"'>

As you can see, the MP4 is the trickiest, as you have to know which codec you're using and the AVC level for the video stream. The one I list above is a common one, but not the only possible one.

like image 106
Jennifer Avatar answered Oct 17 '22 07:10

Jennifer