.webm

Term side of the Card.
Topic: Video
Unit title: .webm
Categories: Format
Explanation side of the Card

Explanation: The open-source video format optimized for online streaming. It supports high-quality video and low latency, making it popular for web video playback and supported by most modern browsers.

Example

Wronghtml
<video controls>
  <source src="clip.mp4" type="video/mp4">
  <source src="clip.webm" type="video/webm">
</video>
Righthtml
<video controls>
  <source src="clip.webm" type="video/webm">
  <source src="clip.mp4" type="video/mp4">
</video>

Browsers take the first source they can play, so the smaller WebM goes first and MP4 catches the rest.

Common mistakes

  • Shipping WebM only, so some devices show an empty player.
  • Listing the MP4 source first, so browsers that could use the smaller WebM never pick it.

Key points

  • The WebM <source> comes before the MP4 one, and both have a type attribute.
  • The type can name codecs, like 'video/webm; codecs="vp9, opus"', so unsupported files are skipped.
  • Transparent video uses WebM with an alpha channel and has a fallback for browsers without alpha support.

Interview questions

WebM vs MP4: which is smaller?

With VP9 or AV1, WebM is often smaller than H.264 MP4 at the same quality. MP4 with AV1 is similar in size.

Is WebM royalty free?

Yes. WebM and its codecs VP8, VP9, AV1, Vorbis and Opus are open and royalty free.

Can WebM video have a transparent background?

Yes. VP8 and VP9 in WebM support an alpha channel, which is used for overlays and stickers.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy