ISO Base Media file

video/mp4

Safe

Magic Bytes

Offset: 4
66 74 79 70 6D 70 34 32

The MPEG-4 Part 14 (MP4) format is a digital multimedia container standard defined by ISO/IEC as part of the broader MPEG-4 specification. It is universally utilized for storing digital video and audio streams, as well as subtitles and still images, making it the ubiquitous standard for internet streaming. Based directly on the Apple QuickTime File Format, MP4 is generally safe, though malformed containers can potentially trigger vulnerabilities in outdated media players.

Extension

.mp4

MIME Type

video/mp4

Byte Offset

4

Risk Level

Safe

Validation Code

How to validate .mp4 files in Python

Python
def is_mp4(file_path: str) -> bool:
    """
    Check if file is a valid MP4 by magic bytes.
    Signature offset: 4 bytes
    """
    signature = bytes([0x66, 0x74, 0x79, 0x70, 0x6D, 0x70, 0x34, 0x32])
    with open(file_path, "rb") as f:
        f.seek(4)
        return f.read(8) == signature

How to validate .mp4 files in Node.js

Node.js
function isMP4(buffer: Buffer): boolean {
  // Signature offset: 4 bytes
  const signature = Buffer.from([0x66, 0x74, 0x79, 0x70, 0x6D, 0x70, 0x34, 0x32]);
  if (buffer.length < 12) return false;
  return buffer.subarray(4, 12).equals(signature);
}
Go
func IsMP4(data []byte) bool {
    // Signature offset: 4 bytes
    signature := []byte{0x66, 0x74, 0x79, 0x70, 0x6D, 0x70, 0x34, 0x32}
    if len(data) < 12 {
        return false
    }
    return bytes.Equal(data[4:12], signature)
}

API Endpoint

GET /api/v1/mp4
curl https://filesignature.org/api/v1/mp4

Related Formats