Test files › Audio and video › fake-mp4-wrong-magic.mp4

Fake MP4 with wrong magic bytes

Named .mp4 but the first bytes are random noise rather than an ftyp box. Contains no video data.

↓ Download fake-mp4-wrong-magic.mp4
Filenamefake-mp4-wrong-magic.mp4
FormatMP4 (spoofed)
Size64.0 KB (65,536 bytes)
MIME typevideo/mp4
SHA-256678b109814ee687b8672b6fe9f559cfae722aa79285ac23bf1ca792de9e97ded
What this file catchesTranscode queues that accept a job based on the extension and only discover the file is not video after burning a worker slot on it. Validate the ftyp box at upload time.

Handle it in code

Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.

Python

An MP4 is a sequence of boxes: a 4-byte size, a 4-byte type, then the contents. Walking the top level shows a missing moov box (no index, so nothing to play) or a file that is not an MP4 at all, without a media library.

import struct

kinds = []
with open("fake-mp4-wrong-magic.mp4", "rb") as f:
    while len(head := f.read(8)) == 8:
        size, kind = struct.unpack(">I4s", head)
        header = 8
        if size == 1:  # a 64-bit size follows
            size, header = struct.unpack(">Q", f.read(8))[0], 16
        kinds.append(kind.decode("ascii") if all(32 <= b < 127 for b in kind) else "0x" + kind.hex())
        if size == 0:
            break  # the box runs to the end of the file
        if size < header:
            print(f"rejected: box {kinds[-1]!r} declares {size} bytes")
            break
        f.seek(size - header, 1)
if not kinds or kinds[0] != "ftyp":
    print("not an MP4: the first box is", kinds[0] if kinds else "missing")
elif "moov" not in kinds:
    print("boxes:", ", ".join(kinds) + "; no moov box, so there is nothing to play")
else:
    print("boxes:", ", ".join(kinds))

Run against this file, it prints: not an MP4: the first box is 0x62dda363

Related guides and tools

Sample MP3, WAV and MP4 filesFile signaturesMIME typesCheck a file's real typeVerify its SHA-256

Download & verify

curl -fsSL -o "fake-mp4-wrong-magic.mp4" "https://files.hexaqa.com/video/fake-mp4-wrong-magic.mp4"
curl -fsSL "https://files.hexaqa.com/video/fake-mp4-wrong-magic.mp4" | sha256sum # expect: 678b109814ee687b8672b6fe9f559cfae722aa79285ac23bf1ca792de9e97ded

More audio and video test files

declared-length-mismatch.wavno-id3-raw.mp3silence-30s.wavsilence-5s.mp3tone-5s.wavtruncated-header.wavvery-short-10ms.wavempty-ftyp-only.mp4

← All Audio and video files