Skip to content

OPUS (.opus)

.opus file signature | audio/opus

Safe

Magic Bytes

Offset 0
4F 67 67 53 00 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 4F 70 75 73 48 65 61 64

Sources: Apache Tika

Extension

.opus

MIME Type

audio/opus

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .opus files in Python

Python
def is_opus(file_path: str) -> bool:
    """Check if file is a valid OPUS by magic bytes."""
    signature = bytes([0x4F, 0x67, 0x67, 0x53, 0x00, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64])
    with open(file_path, "rb") as f:
        return f.read(36) == signature

How to validate .opus files in Node.js

Node.js
function isOPUS(buffer: Buffer): boolean {
  const signature = Buffer.from([0x4F, 0x67, 0x67, 0x53, 0x00, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64]);
  return buffer.subarray(0, 36).equals(signature);
}

How to validate .opus files in Go

Go
func IsOPUS(data []byte) bool {
    signature := []byte{0x4F, 0x67, 0x67, 0x53, 0x00, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64}
    if len(data) < 36 {
        return false
    }
    return bytes.Equal(data[:36], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .opus file?

A .opus file is a OPUS file.

What are the magic bytes for .opus files?

The magic bytes for OPUS files are 4F 67 67 53 00 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 4F 70 75 73 48 65 61 64 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .opus file?

To validate a .opus file, read the first bytes of the file and compare them against the known magic bytes (4F 67 67 53 00 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 2E 4F 70 75 73 48 65 61 64) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .opus files?

The primary MIME type for .opus files is audio/opus.

Is it safe to open .opus files?

OPUS (.opus) 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.