VTT
text/vtt
Magic Bytes
Offset: 0
57 45 42 56 54 54 0D
Web Video Text Tracks (WebVTT) is a standard file format maintained by the World Wide Web Consortium (W3C) for displaying timed text synchronized with video media. It is primarily utilized for providing closed captions, subtitles, chapter navigation, and descriptive text tracks for HTML5 video elements. As a plain-text format, WebVTT is considered safe for general use, though parsers must handle potential metadata vulnerabilities to prevent cross-site scripting attacks in specific web environments.
Validation Code
How to validate .vtt files in Python
Python
def is_vtt(file_path: str) -> bool:
"""Check if file is a valid VTT by magic bytes."""
signature = bytes([0x57, 0x45, 0x42, 0x56, 0x54, 0x54, 0x0D])
with open(file_path, "rb") as f:
return f.read(7) == signature
How to validate .vtt files in Node.js
Node.js
function isVTT(buffer: Buffer): boolean {
const signature = Buffer.from([0x57, 0x45, 0x42, 0x56, 0x54, 0x54, 0x0D]);
return buffer.subarray(0, 7).equals(signature);
}
Go
func IsVTT(data []byte) bool {
signature := []byte{0x57, 0x45, 0x42, 0x56, 0x54, 0x54, 0x0D}
if len(data) < 7 {
return false
}
return bytes.Equal(data[:7], signature)
}
API Endpoint
GET
/api/v1/vtt
curl https://filesignature.org/api/v1/vtt