Resource Interchange File Format --Windows Audio VideoInterleave file
video/x-msvideo
Magic Bytes
Offset: 0
52 49 46 46 2E 2E 2E 2E 41 56 49 20
Audio Video Interleave (AVI) is a multimedia container format developed by Microsoft as part of its Video for Windows technology. It facilitates the synchronous playback of audio and video data across numerous media players and video editing applications. While now categorized as a legacy format superseded by modern standards like MP4, it remains a common choice for archival storage and recordings from older digital cameras.
Validation Code
How to validate .avi files in Python
Python
def is_avi(file_path: str) -> bool:
"""Check if file is a valid AVI by magic bytes."""
signature = bytes([0x52, 0x49, 0x46, 0x46, 0x2E, 0x2E, 0x2E, 0x2E, 0x41, 0x56, 0x49, 0x20])
with open(file_path, "rb") as f:
return f.read(12) == signature
How to validate .avi files in Node.js
Node.js
function isAVI(buffer: Buffer): boolean {
const signature = Buffer.from([0x52, 0x49, 0x46, 0x46, 0x2E, 0x2E, 0x2E, 0x2E, 0x41, 0x56, 0x49, 0x20]);
return buffer.subarray(0, 12).equals(signature);
}
Go
func IsAVI(data []byte) bool {
signature := []byte{0x52, 0x49, 0x46, 0x46, 0x2E, 0x2E, 0x2E, 0x2E, 0x41, 0x56, 0x49, 0x20}
if len(data) < 12 {
return false
}
return bytes.Equal(data[:12], signature)
}
API Endpoint
GET
/api/v1/avi
curl https://filesignature.org/api/v1/avi