Standard Opus Audio MIME Type for HTTP
This article explains the standard MIME type used for streaming and transferring Opus audio files over HTTP. It details the official media types defined by the Internet Engineering Task Force (IETF) for different container formats and provides practical configuration examples for web servers to ensure proper browser playback.
The standard MIME type for the Opus audio format when served over HTTP depends on the container file format used to package the audio. Because Opus is a codec, it must be wrapped in a container to be transmitted as a file.
The Primary Standard: Ogg Container
Most standalone Opus files, which typically use the
.opus extension, are encapsulated in an Ogg container.
According to RFC 7845, the official and most compatible MIME type for
Ogg-encapsulated Opus audio over HTTP is:
audio/ogg
To explicitly specify the codec to modern web browsers and media players, the standard media type string is:
audio/ogg; codecs=opus
The WebM Container
When Opus audio is encapsulated in a WebM container (frequently used for HTML5 audio and video streaming), the correct MIME type is:
audio/webm; codecs=opus
The Raw Opus MIME Type
RFC 7587 defines the media type
audio/opus, but this is officially
designated for raw RTP (Real-time Transport Protocol) streams rather
than HTTP file storage and playback. While some modern web applications
and servers accept audio/opus for files ending in
.opus, using audio/ogg ensures the broadest
compatibility across legacy and modern web browsers.
Web Server Configuration
To ensure browsers correctly stream and play .opus files
instead of attempting to download them as raw binary data, web servers
must be configured to map the file extension to the correct MIME
type.
For Apache servers, add the following directive to your configuration
or .htaccess file:
AddType audio/ogg .opus
For Nginx servers, include this mapping within your
mime.types file:
audio/ogg opus;