MP2
audio/mpeg
Magic Bytes
Offset: 0
FF F2
MPEG-1 Audio Layer II (MP2) is a lossy audio compression format standardized by the Moving Picture Experts Group (MPEG). It primarily serves as a standard for digital audio broadcasting and television transmission, historically functioning as the direct predecessor to the widely adopted MP3 format. While largely superseded by newer codecs for consumer applications, it remains active in professional broadcast environments and poses minimal security risks as a non-executable media container.
Validation Code
How to validate .mp2 files in Python
Python
def is_mp2(file_path: str) -> bool:
"""Check if file is a valid MP2 by magic bytes."""
signature = bytes([0xFF, 0xF2])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .mp2 files in Node.js
Node.js
function isMP2(buffer: Buffer): boolean {
const signature = Buffer.from([0xFF, 0xF2]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsMP2(data []byte) bool {
signature := []byte{0xFF, 0xF2}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/mp2
curl https://filesignature.org/api/v1/mp2