Opus Recommended Settings: Difference between revisions
m (→Recommended Bitrates: slight reformatting, adding nbsp's for number ranges) |
m (→Bandwidth Transition Thresholds: stop hiding bandwidth ranges under attr tags) |
||
Line 78: | Line 78: | ||
{| class="wikitable" style="text-align:center" | {| class="wikitable" style="text-align:center" | ||
|- | |- | ||
| | !rowspan="3"|Bandpass Range (Hz) | ||
!colspan="4"|Rough Bitrate Required (Kb/s) | |||
|- | |||
!colspan="2"|Mono | !colspan="2"|Mono | ||
!colspan="2"|Stereo | !colspan="2"|Stereo | ||
Line 88: | Line 90: | ||
!Music | !Music | ||
|- | |- | ||
|style="text-align:right;"|NarrowBand (3 - 4000) | |||
|12 | |12 | ||
|15 | |15 | ||
Line 94: | Line 96: | ||
|? | |? | ||
|- | |- | ||
|style="text-align:right;"|MediumBand (3 - 6000) | |||
|15 | |15 | ||
|18-22 | |18-22 | ||
Line 100: | Line 102: | ||
|? | |? | ||
|- | |- | ||
|style="text-align:right;"|WideBand (3 - 8000) | |||
|16-20 | |16-20 | ||
|22-28 | |22-28 | ||
Line 106: | Line 108: | ||
|? | |? | ||
|- | |- | ||
|style="text-align:right;"|SuperWideBand (3-12000) | |||
|24-28 | |24-28 | ||
|28-32 | |28-32 | ||
Line 112: | Line 114: | ||
|? | |? | ||
|- | |- | ||
|style="text-align:right;"|FullBand (3-20000) | |||
|28-40 | |28-40 | ||
|32-64 | |32-64 |
Revision as of 06:37, 14 December 2016
Recommended Bitrates
Depending on the kind of audio you want to encode with Opus, you may want to use different bitrate (quality) settings.
The settings in the table below are meant to start you off with a decent tradeoff between good quality and small file size (or bitrate usage, if you're streaming).
You should test the suggested bitrate by actually listening to your encoded audio and then:
- tweaking the bitrate down if you think the quality is good, but the file size (or bitrate) is too big,
- tweaking the bitrate up if you think the quality is bad, and you can afford having bigger files (or a larger streaming bitrate).
Use Case | Channels | Bitrate (Kb/s) | Notes |
---|---|---|---|
Low bandwidth HF/VHF digital radio | 1 (mono) | Use Codec 2 | Opus only supports bitrates down to 6 Kb/s. Codec 2 handles ultra low bitrate speech at 0.7 - 3.2 Kb/s. |
VoIP | 1 | 10 - 24 | 10 Kb/s will deliver narrowband most of the time, 24 Kb/s should give fullband. More details in the relevant table further down this page. |
Audiobooks / Podcasts | 1 | 24 | Bitrates from here on up tend to deliver fullband audio. |
2 (stereo) | 32 | ||
Music Streaming / Radio | 2 | 64 - 96 | Opus has better quality than MP3, AAC and Vorbis at these rates. |
Music Storage | 2 | 96 - 128 | Opus at 128 KB/s (VBR) is pretty much transparent. |
6 (5.1 surround) | 128 - 256 | For surround sound, Opus uses surround-sound bitrate allocation. | |
8 (7.1 surround) | 256 - 450 | ||
Music Archiving | 1 - 8 | Use FLAC | If you are archiving audio, use a lossless audio format to prevent generation loss. |
Technical Details
For the more technical Opus users, here are some details to help you fine-tune your decision on which bitrate best fits your needs.
Mono or Stereo
Opus tends to start downmixing stereo inputs to mono from roughly 24 Kb/s and lower. You can check the details in the opus_encoder.c source file.
You can force downmixing at any bitrate by using the following command-line parameters:
--downmix-mono
- downmixes all input channels to mono
--downmix-stereo
- downmixes all input channels to stereo (if there are more than 2 input channels, e.g. surround sound)
Bandwidth Transition Thresholds
The following table shows rough bitrates that you might want to use to encode audio that has limited frequency bandwidths. This could be useful if your audio has already been bandpassed, or should go through a bandpass filter (e.g. VoIP speech).
Bandpass Range (Hz) | Rough Bitrate Required (Kb/s) | |||
---|---|---|---|---|
Mono | Stereo | |||
Voice | Music | Voice | Music | |
NarrowBand (3 - 4000) | 12 | 15 | ? | ? |
MediumBand (3 - 6000) | 15 | 18-22 | ? | ? |
WideBand (3 - 8000) | 16-20 | 22-28 | ? | ? |
SuperWideBand (3-12000) | 24-28 | 28-32 | ? | ? |
FullBand (3-20000) | 28-40 | 32-64 | 32-64 | 64-128 |
The details of Opus' bandpass thresholds can be found in the opus_encoder.c source file.
The HydrogenAudio wiki also has some great information on Opus and its usage.
Framesize Tweaking
Opus can encode frames of 2.5, 5, 10, 20, 40, or 60 ms. It can also combine multiple frames into packets of up to 120 ms.
Opus uses a 20 ms frame size by default, as it gives a decent mix of low latency and good quality.
For real-time applications, sending fewer packets per second reduces the overall bitrate, since it reduces the overhead from IP, UDP, and RTP headers. However, it increases latency and sensitivity to packet losses, as losing one packet constitutes a loss of a bigger chunk of audio. Increasing the frame duration also slightly improves coding efficiency, but the gain becomes small for frame sizes above 20 ms.
For these reasons, the default 20 ms frames are a good choice for most applications.
Trading Coding Efficiency with CPU Time
The Opus encoder uses its maximum algorithmic complexity setting of 10 by default. This means that it does not hesitate to use CPU to give you the best quality encoding at a given bitrate.
If the CPU usage is too high for the system you are using Opus on, you can try a lower complexity setting. The allowed values span from 10 (highest CPU usage and quality) down to 0 (lowest CPU usage and quality).