WebM video file
application/octet-stream
Magic Bytes
Offset: 0
1A 45 DF A3
WebM is an open-source audiovisual media file format primarily developed by Google and sponsored by the WebM Project. It is designed for use in HTML5 video elements and is commonly utilized for web streaming, online advertising, and efficient video playback within modern browsers. As a subset of the Matroska container, the format is generally considered safe, although users should ensure media players are updated to prevent vulnerabilities associated with complex codec implementations.
Validation Code
How to validate .webm files in Python
Python
def is_webm(file_path: str) -> bool:
"""Check if file is a valid WEBM by magic bytes."""
signature = bytes([0x1A, 0x45, 0xDF, 0xA3])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .webm files in Node.js
Node.js
function isWEBM(buffer: Buffer): boolean {
const signature = Buffer.from([0x1A, 0x45, 0xDF, 0xA3]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsWEBM(data []byte) bool {
signature := []byte{0x1A, 0x45, 0xDF, 0xA3}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/webm
curl https://filesignature.org/api/v1/webm