MPG4

video/mp4

Safe

Magic Bytes

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

MPG4 is a digital multimedia container format developed by the Moving Picture Experts Group (MPEG) as part of the ISO/IEC 14496 standard. It is primarily utilized to store digital video and audio streams, facilitating streaming over the internet and playback on compatible media players. While functionally identical to the common MP4 format, this specific file extension is a non-standard variation occasionally encountered on legacy hardware or proprietary recording software.

Extension

.mpg4

MIME Type

video/mp4

Byte Offset

4

Risk Level

Safe

Validation Code

How to validate .mpg4 files in Python

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

How to validate .mpg4 files in Node.js

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

API Endpoint

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

Related Formats