BroadRouter
Get started

Ogg Opus

Updated

Ogg Opus is audio encoded with the Opus codec (RFC 6716) and stored in an Ogg container (RFC 7845). It is built for speech and interactive audio at low bitrates, and it is the format WhatsApp uses for voice notes, usually as .ogg or .opus files.

Also called: Opus codec, Opus audio, Ogg, OGG file, Ogg/Opus

Download a WhatsApp voice note and you get a small .ogg file. Inside is Opus audio, a codec designed for voice calls.

How it works

There are two layers, each defined by an IETF RFC:

Layer Spec What it does
Opus codec RFC 6716 Compresses the audio. It combines a linear-prediction layer based on SILK with an MDCT layer based on CELT, and runs from 6 kbit/s narrowband speech up to 510 kbit/s stereo music
Ogg container RFC 7845 Wraps the Opus packets in a file, starting with an OpusHead identification header

RFC 6716 lists five bandwidths, from narrowband (8 kHz sample rate) to fullband (48 kHz). RFC 7845 says granule positions always count samples at 48 kHz, whatever rate the decoder outputs. It recommends the .opus extension and the audio/ogg media type, optionally audio/ogg; codecs=opus.

Meta’s WhatsApp Cloud API media reference lists OGG audio as audio/ogg with “Opus codec only”, mono, up to 16 MB.

Why it matters

  • Many APIs will not take it. A speech-to-text endpoint that accepts only WAV or MP3 rejects a voice note until you convert it.
  • Conversion is cheap. One ffmpeg command decodes Opus to PCM. The result is much larger than the voice note, so watch file-size caps.
  • Name confusion. “Opus” is also a model name at other providers. In audio contexts it means the codec.

On BroadNet Inference

BroadNet’s transcription endpoint accepts WAV (audio/wav) or MP3 (audio/mpeg) only, up to 26,214,400 bytes per file. Its docs convert a WhatsApp voice note in one step:

ffmpeg -i voice-note.ogg -ar 16000 -ac 1 voice-note.wav

-ar sets the audio sampling frequency and -ac the number of channels, per the ffmpeg documentation, so this writes 16 kHz mono WAV. Then send it with language=ar (or en) to BroadNet Transcribe Arabic or BroadNet Transcribe. The WhatsApp voice notes guide has a script that converts and transcribes a whole folder, and the n8n guide does it inside a workflow. For a voice note too long for one file, the audio splitter works out the chunks.

Common mistakes

  • Renaming instead of converting. Changing .ogg to .wav does not change the audio inside. Decode with ffmpeg.
  • Skipping -ac 1. Stereo doubles the WAV size without helping transcription.

Questions

Is an .ogg file always Opus?

No. Ogg is a container and can hold other codecs. WhatsApp's Cloud API accepts audio/ogg only with the Opus codec, and only mono, so WhatsApp voice notes are Ogg Opus.

Can I send an .ogg voice note straight to BroadNet?

No. BroadNet's transcription endpoint accepts WAV and MP3. Convert first with ffmpeg -i voice-note.ogg -ar 16000 -ac 1 voice-note.wav.

What is the difference between .ogg and .opus files?

RFC 7845 recommends the .opus extension for Ogg Opus files and audio/ogg as the media type. Many apps still use .ogg for the same content.

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity