M4B

audio/mp4

Safe

Magic Bytes

Offset: 4
66 74 79 70 4D 34 41 20

The M4B file format is an MPEG-4 audio container developed by Apple Inc., functioning identically to M4A but specifically designated for audiobooks and podcasts. It is primarily used for distributing long-form audio content that requires embedded chapter markers and bookmarking capabilities to resume playback. While standard files are generally safe, content purchased from the iTunes Store may contain FairPlay DRM encryption to restrict playback to authorized devices.

Extension

.m4b

MIME Type

audio/mp4

Byte Offset

4

Risk Level

Safe

Validation Code

How to validate .m4b files in Python

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

How to validate .m4b files in Node.js

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

API Endpoint

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

Related Formats