M2P
application/octet-stream
Magic Bytes
Offset: 0
00 00 01 BA
The M2P file extension denotes an MPEG-2 Program Stream, a multimedia container format standardized by the Moving Picture Experts Group (MPEG). It is primarily designed for storing multiplexed digital video and audio data on reliable storage media like DVDs and hard drives. While historically dominant in digital broadcasting and physical media, this legacy format has largely been superseded by more efficient MPEG-4 containers for modern streaming applications.
Validation Code
How to validate .m2p files in Python
Python
def is_m2p(file_path: str) -> bool:
"""Check if file is a valid M2P by magic bytes."""
signature = bytes([0x00, 0x00, 0x01, 0xBA])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .m2p files in Node.js
Node.js
function isM2P(buffer: Buffer): boolean {
const signature = Buffer.from([0x00, 0x00, 0x01, 0xBA]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsM2P(data []byte) bool {
signature := []byte{0x00, 0x00, 0x01, 0xBA}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/m2p
curl https://filesignature.org/api/v1/m2p