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

The HTML 5 source element has the src and type attribute, for example:

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

Where is the complete list of MIME types for the type attribute along with the values โ€‹โ€‹of the corresponding valid codec values?

+8
html5 html5-video
source share
1 answer

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

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

  • WebM: audio / webm, video / webm
  • OGG: app / ogg, audio / oggm, video / ogg
  • H.264 or MP4: audio / mp 4m, video / mp4

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

  • <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, MP4 is the most difficult since you need to know which codec you are using and the AVC level for the video stream. The one I list above is general, but not the only possible.

+6
source share

All Articles