MPEG video
video/mpeg
Magic Bytes
Offset: 0
00 00 01 BA
The MPEG video file format is a standard digital video container and compression specification developed by the Moving Picture Experts Group. It serves as a foundational method for storing multiplexed audio and video data, historically utilized for distributing movies on physical media like Video CDs and DVDs. Although largely superseded by modern high-efficiency standards like MP4, this legacy format remains supported by most media players for backward compatibility.
Validation Code
How to validate .mpeg files in Python
Python
def is_mpeg(file_path: str) -> bool:
"""Check if file is a valid MPEG by magic bytes."""
signature = bytes([0x00, 0x00, 0x01, 0xBA])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .mpeg files in Node.js
Node.js
function isMPEG(buffer: Buffer): boolean {
const signature = Buffer.from([0x00, 0x00, 0x01, 0xBA]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsMPEG(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/mpeg
curl https://filesignature.org/api/v1/mpeg