Sobes.tech
Junior

What video file formats are supported in HTML5?

sobes.tech AI

Answer from AI

HTML5 officially supports three video file formats:

  • MP4 (H.264 + AAC): Widely used, supported by most browsers and devices thanks to hardware acceleration.
  • WebM (VP8/9 + Vorbis/Opus): An open format developed by Google, well supported in modern browsers.
  • Ogg (Theora + Vorbis): An older open format, less common compared to WebM and MP4.

Support for a specific format may depend on the user's browser and operating system. To ensure maximum compatibility, videos are often provided in multiple formats using the <source> tag inside <video>:

<video controls>
  <source src="myvideo.mp4" type="video/mp4">
  <source src="myvideo.webm" type="video/webm">
  <source src="myvideo.ogv" type="video/ogg">
  Your browser does not support video playback.
</video>