ISO Base Media file (.mp4)
.mp4 file signature | video/mp4
ISO Base Media file (MPEG-4) v1
Magic Bytes
Offset 4
66 74 79 70 69 73 6F 6D
Sources: Wikipedia, Gary Kessler
All Known Signatures
6 signature variants are documented for .mp4 files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 66 74 79 70 69 73 6F 6D | 4 | Wikipedia, Gary Kessler |
| 66 74 79 70 4D 53 4E 56 | 4 | Wikipedia, Gary Kessler |
| 66 74 79 70 6D 70 34 31 | 4 | Apache Tika |
| 66 74 79 70 6D 70 34 32 | 4 | Apache Tika |
| 6D 70 34 32 | 0 | Neil Harvey FileSignatures |
| 69 73 6F 6D | 0 | Neil Harvey FileSignatures |
Extension
.mp4
MIME Type
video/mp4
Byte Offset
4
Risk Level
Safe
Validation Code
How to validate .mp4 files in Python
def is_mp4(file_path: str) -> bool:
"""Check if file is a valid MP4 by magic bytes."""
signature = bytes([0x66, 0x74, 0x79, 0x70, 0x69, 0x73, 0x6F, 0x6D])
with open(file_path, "rb") as f:
return f.read(8) == signature
How to validate .mp4 files in Node.js
function isMP4(buffer: Buffer): boolean {
const signature = Buffer.from([0x66, 0x74, 0x79, 0x70, 0x69, 0x73, 0x6F, 0x6D]);
return buffer.subarray(0, 8).equals(signature);
}
How to validate .mp4 files in Go
func IsMP4(data []byte) bool {
signature := []byte{0x66, 0x74, 0x79, 0x70, 0x69, 0x73, 0x6F, 0x6D}
if len(data) < 8 {
return false
}
return bytes.Equal(data[:8], signature)
}
API Endpoint
/api/v1/mp4
curl https://filesignature.org/api/v1/mp4
See the full API documentation for all endpoints and parameters.
Frequently Asked Questions
What is a .mp4 file?
A .mp4 file is a ISO Base Media file file. ISO Base Media file (MPEG-4) v1
What are the magic bytes for .mp4 files?
The magic bytes for ISO Base Media file files are 66 74 79 70 69 73 6F 6D at byte offset 4. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .mp4 file?
To validate a .mp4 file, read the first bytes of the file and compare them against the known magic bytes (66 74 79 70 69 73 6F 6D) at offset 4. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .mp4 files?
The primary MIME type for .mp4 files is video/mp4.
Is it safe to open .mp4 files?
ISO Base Media file (.mp4) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.