M2V
video/mpeg
Magic Bytes
Offset: 0
00 00 01 B3
M2V is a video file format containing a raw MPEG-2 video stream, developed by the Moving Picture Experts Group (MPEG). This elementary stream format excludes audio data and is primarily utilized in DVD authoring and non-linear video editing workflows where audio and video are processed separately before final multiplexing. Although largely superseded by modern codecs like H.264 for digital streaming, the format remains a standard component for physical media production and legacy broadcast archival.
Validation Code
How to validate .m2v files in Python
Python
def is_m2v(file_path: str) -> bool:
"""Check if file is a valid M2V by magic bytes."""
signature = bytes([0x00, 0x00, 0x01, 0xB3])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .m2v files in Node.js
Node.js
function isM2V(buffer: Buffer): boolean {
const signature = Buffer.from([0x00, 0x00, 0x01, 0xB3]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsM2V(data []byte) bool {
signature := []byte{0x00, 0x00, 0x01, 0xB3}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/m2v
curl https://filesignature.org/api/v1/m2v