# WebM: The Open Web Video Format — Complete Guide
**WebM** is a video format designed specifically for the web by Google, released in 2010 as a royalty-free alternative to patented formats like H.264. It's the native web video format for Chrome and Firefox.
## What is WebM
WebM is a video container based on Matroska (MKV) that can hold:
- **Video**: VP8, VP9, or AV1
- **Audio**: Vorbis or Opus
- **Subtitles**: WebVTT
Unlike MP4 (which can contain H.264, H.265, AV1…), WebM is designed for a specific set of open codecs.
## WebM vs MP4: key differences
| Aspect | WebM | MP4 |
|--------|------|-----|
| Container | MKV-based | ISOBMFF |
| Video codecs | VP8, VP9, AV1 | H.264, H.265, AV1, MPEG-4 |
| Audio codecs | Vorbis, Opus | AAC, MP3, AC-3, Opus |
| Licensing | Royalty-free | Some patented (H.264) |
| Browser support | Chrome, Firefox, Edge, Opera | Universal (incl. Safari) |
| Safari / iOS | ❌ (no native support) | ✅ |
| Adaptive streaming | DASH | HLS + DASH |
| Transparency (alpha) | VP9 with alpha | Limited |
## Browser compatibility (2024)
| Browser | VP8/WebM | VP9/WebM | AV1/WebM |
|---------|----------|----------|----------|
| Chrome 90+ | ✅ | ✅ | ✅ |
| Firefox 90+ | ✅ | ✅ | ✅ |
| Edge (Chromium) | ✅ | ✅ | ✅ |
| Safari (macOS/iOS) | ❌ | ❌ (partial since Safari 16.4) | ❌ |
| Opera | ✅ | ✅ | ✅ |
| Android WebView | ✅ | ✅ | ✅ |
**The big problem**: Safari (iPhone, iPad, macOS) doesn't support WebM natively. For maximum compatibility, you must serve MP4 as a fallback.
## Correct pattern for web video with WebM
```html
```
The browser uses the first `` it can play. Chrome picks WebM; Safari picks MP4.
## Converting to WebM with FFmpeg
```bash
# WebM with VP9 (better quality than VP8)
ffmpeg -i video.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus -b:a 128k video.webm
# WebM with VP8 (more compatible, lower quality)
ffmpeg -i video.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis video_vp8.webm
# WebM with AV1 (best compression, very slow encoding)
ffmpeg -i video.mp4 -c:v libaom-av1 -crf 30 -b:v 0 -c:a libopus -b:a 128k video_av1.webm
# Generate both formats at once
ffmpeg -i original.mp4 \
-c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus video.webm \
-c:v libx264 -crf 23 -c:a aac video.mp4
```
## VP8, VP9, and AV1: which to use?
| Codec | Quality | Encoding speed | Compatibility |
|-------|---------|----------------|---------------|
| VP8 | Good (similar to H.264) | Fast | Chrome, Firefox, Edge |
| VP9 | Very good (~30% better than VP8) | Slow | Chrome, Firefox, Edge, Android |
| AV1 | Excellent (~50% better than H.264) | Very slow | Chrome 70+, Firefox 67+, Android 10+ |
For most use cases: **VP9 + Opus** in WebM is currently the best combination.
## When to use WebM
**Use WebM when:**
- Serving video on your own site and want the smallest possible file size
- Your audience primarily uses Chrome, Firefox, or Android
- You need transparency (alpha channel) in a video
- You want to avoid H.264 royalties
**Use MP4 when:**
- You need iOS / Safari compatibility without a fallback
- Distributing on platforms (YouTube, Vimeo, social media)
- Encoding speed is critical
## WebM for video with transparent background
WebM with VP9 supports an alpha channel (transparency), which is useful for:
- Video overlays on top of backgrounds
- High-quality animations with transparency (better alternative to GIF)
```bash
# Create WebM with alpha from a MOV with transparency
ffmpeg -i transparent_video.mov -c:v libvpx-vp9 -pix_fmt yuva420p alpha_video.webm
```
## Conclusion
WebM is an excellent choice for modern web content if you can provide an MP4 fallback for Safari. The VP9/Opus combination in WebM offers better quality-to-size ratio than H.264/AAC in MP4, with zero licensing costs.
We use cookies and similar technologies to personalise content and ads, and to analyse traffic.
Learn more.