About WebM video files
An open format with VP9 or AV1 video and Opus audio, played by all current browsers. It is also what MediaRecorder produces in Chrome and Firefox, so screen and webcam recordings uploaded from a browser are usually WebM.
File signature
WEBM files start with 1A 45 DF A3 (EBML header, shared with Matroska). The extension and the type a browser reports for an upload both
come from the file name, so check these bytes on the server before trusting a file.
Serve .webm with the right Content-Type
Content-Type: video/webm
video/webm webm;
AddType video/webm .webm
@webm path *.webm
header @webm Content-Type "video/webm"
curl -sI https://example.com/file.webm | grep -i '^content-type'
# Content-Type: video/webm
Set the type in code
res.set('Content-Type', 'video/webm');
// Or make the browser download it:
res.attachment('file.webm');
import mimetypes
mimetypes.add_type('video/webm', '.webm') # if your system doesn't know it
mimetypes.guess_type('file.webm')[0] # 'video/webm'
mime.AddExtensionType(".webm", "video/webm")
w.Header().Set("Content-Type", "video/webm")
Accept .webm uploads
<input type="file" accept=".webm,video/webm">
The accept attribute only filters the file picker; users can still choose another file. Listing the
extension as well as the type matters, because operating systems don’t always report the type you expect.
Related types
More video
.mov , .avi , .m3u8 , .ts . Look up any extension or type with the MIME type lookup.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What is the MIME type for .webm files?
video/webm. The full header is "Content-Type: video/webm".
Why does my server send the wrong Content-Type for .webm?
Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .webm is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".
How can I check that a file really is WEBM?
Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. WEBM files start with 1A 45 DF A3 (EBML header, shared with Matroska). The MIME type lookup on this site reads them for you when you drop a file on it.