3GP
video/3gpp
Magic Bytes
Offset: 4
66 74 79 70 33 67 65 36
The 3GP container format is a multimedia standard developed by the Third Generation Partnership Project for use on 3G mobile networks. It facilitates the capture, storage, and transmission of video and audio streams, specifically optimized for devices with limited bandwidth and storage capacity. While primarily a legacy format today, it is considered safe for media playback and remains functional for backward compatibility with older mobile hardware and legacy telecommunication systems.
Validation Code
How to validate .3gp files in Python
Python
def is_3gp(file_path: str) -> bool:
"""
Check if file is a valid 3GP by magic bytes.
Signature offset: 4 bytes
"""
signature = bytes([0x66, 0x74, 0x79, 0x70, 0x33, 0x67, 0x65, 0x36])
with open(file_path, "rb") as f:
f.seek(4)
return f.read(8) == signature
How to validate .3gp files in Node.js
Node.js
function is3GP(buffer: Buffer): boolean {
// Signature offset: 4 bytes
const signature = Buffer.from([0x66, 0x74, 0x79, 0x70, 0x33, 0x67, 0x65, 0x36]);
if (buffer.length < 12) return false;
return buffer.subarray(4, 12).equals(signature);
}
Go
func Is3GP(data []byte) bool {
// Signature offset: 4 bytes
signature := []byte{0x66, 0x74, 0x79, 0x70, 0x33, 0x67, 0x65, 0x36}
if len(data) < 12 {
return false
}
return bytes.Equal(data[4:12], signature)
}
API Endpoint
GET
/api/v1/3gp
curl https://filesignature.org/api/v1/3gp