What is a WebM file?
WebM is an open, royalty-free media container format developed by Google and released in 2010, built on the Matroska (MKV) container specification. It was created specifically for the web as an alternative to patented codecs like H.264/MP4, pairing the VP8 or VP9 video codecs with Vorbis or Opus audio. The AV1 video codec is also supported in newer implementations. All major browsers support WebM natively, and YouTube uses WebM internally for storage and streaming of VP9-encoded video.
WebM’s royalty-free nature makes it a politically important format — any website or service can use it without licensing fees, unlike H.264 (which requires patent royalties in some jurisdictions).
How to open WebM files
- All modern browsers (Chrome, Firefox, Edge, Opera) — Native HTML5 playback
- VLC Media Player (Windows, macOS, Linux) — Full support
- MPV (Windows, macOS, Linux) — Lightweight, open-source player
- MPC-HC (Windows) — Free, lightweight player
- FFmpeg — Command-line playback and conversion
Note: Safari and QuickTime have limited WebM support; use MP4/H.264 for maximum compatibility on Apple devices.
Technical specifications
| Property | Value |
|---|---|
| Container | Matroska-based (subset) |
| Video codecs | VP8, VP9, AV1 |
| Audio codecs | Vorbis, Opus |
| Max resolution | Codec-dependent (VP9: up to 8K) |
| HDR | Supported with VP9 and AV1 |
| Streaming | Adaptive bitrate streaming |
| Magic bytes | 1A 45 DF A3 (EBML signature, shared with MKV) |
| MIME type | video/webm |
VP8 vs VP9 vs AV1
| Codec | Quality at same bitrate | Encoding speed | Browser support |
|---|---|---|---|
| VP8 | Good | Fast | Excellent |
| VP9 | ~30-50% better than VP8 | Moderate | Excellent |
| AV1 | ~30% better than VP9 | Slow | Good (modern browsers) |
VP9 is the sweet spot for quality and compatibility. AV1 is the future — YouTube and Netflix have adopted it for bandwidth savings, but encoding is still CPU-intensive.
Common use cases
- Web video: HTML5
<video>element playback without a plugin - YouTube: Google stores all YouTube videos in WebM (VP9) internally, transcoding to H.264 only for Safari/iOS compatibility
- Screen recording: Browser-based recording tools (like
MediaRecorderAPI) produce WebM by default in Chrome - Open-source projects: Royalty-free distribution without licensing concerns
- WebRTC: Real-time video calls in the browser use VP8/VP9 in WebM containers
Using WebM in HTML5
<video controls width="1280" height="720">
<source src="video.webm" type="video/webm">
<source src="video.mp4" type="video/mp4">
<p>Your browser doesn't support HTML5 video.</p>
</video>
Listing WebM first serves it to Chrome/Firefox; MP4 acts as fallback for Safari/Edge without VP9 support. This two-source approach covers 99%+ of browser users.
Converting WebM to MP4
# Basic WebM to MP4 (H.264 + AAC)
ffmpeg -i video.webm -c:v libx264 -c:a aac output.mp4
# Preserve quality (slower encoding)
ffmpeg -i video.webm -c:v libx264 -crf 18 -c:a aac -b:a 192k output.mp4
# Extract audio only as MP3
ffmpeg -i video.webm -vn -c:a libmp3lame -q:a 2 audio.mp3
# Convert to animated GIF (small size)
ffmpeg -i video.webm -vf "fps=10,scale=480:-1" output.gif
Recording WebM in the browser
The MediaRecorder API lets web applications capture audio/video and save as WebM:
const stream = await navigator.mediaDevices.getDisplayMedia({ video: true });
const recorder = new MediaRecorder(stream, { mimeType: 'video/webm;codecs=vp9' });
const chunks = [];
recorder.ondataavailable = e => chunks.push(e.data);
recorder.onstop = () => {
const blob = new Blob(chunks, { type: 'video/webm' });
const url = URL.createObjectURL(blob);
// Download or process the recording
};
recorder.start();
This is how browser-based screen recorders, video conferencing apps, and recording tools capture video without server-side processing.