M2A
audio/mpeg
Magic Bytes
Offset: 0
FF F2
MPEG-1 Audio Layer II (M2A) is a lossy audio compression format developed by the Moving Picture Experts Group (MPEG) as a predecessor to the MP3 standard. It was historically used for digital audio broadcasting, Video CDs, and as the primary audio track for DVD media. While largely superseded by modern codecs like AAC for consumer storage, this legacy format remains supported by most media players and is considered safe for general playback.
Validation Code
How to validate .m2a files in Python
Python
def is_m2a(file_path: str) -> bool:
"""Check if file is a valid M2A by magic bytes."""
signature = bytes([0xFF, 0xF2])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .m2a files in Node.js
Node.js
function isM2A(buffer: Buffer): boolean {
const signature = Buffer.from([0xFF, 0xF2]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsM2A(data []byte) bool {
signature := []byte{0xFF, 0xF2}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/m2a
curl https://filesignature.org/api/v1/m2a