[opus] Is there a latency difference between uncompressed UDP (ie Jacktrip) and Opus?

Ralph Giles giles at thaumas.net
Sun Jul 18 00:31:31 UTC 2021

On Mon, 2021-06-14 at 00:13 +0000, Matt Keys wrote:

> The underlying question being -- which (opus stereo at 48k or
> uncompressed UDP) is best for lowest latency and highest quality
> audio while assuming the endpoints are physically distant? As far as
> I can tell Jacktrip recommends max distance of 250 miles or less
> between clients, and "Research suggests it's very difficult to
> perform music with a delay greater than 25 milliseconds". 

I would say the main difference is the data size compression Opus
offers. Uncompressed audio will always be higher quality, especially if
you're doing further processing on the feed. But Opus audio can be less
that 1/10th the space. Depending on how fast your network connection
is, that can be the difference between it working, or not.

The trade-off is that Opus needs to work on fixed blocks of audio,
while with uncompressed you can in theory send a sample at a time. We
recommend 20 ms blocks for general use, and 10 ms for interactive use.
But 10 ms (480 samples at 48 kHz) is still much larger than the 64
samples or so jack uses for its buffers. That's almost half of your 25
ms latency budget! Now, Opus goes down to 2.5 ms (120 samples) but
going smaller than 10 ms hurts compression efficiency, when means you
need to give it more bits. Each network packet also has a fixed
overhead, which at very low latencies can be larger than the audio! So
in general it's diminishing returns below 10 ms.

25 ms is a reasonable rule of thumb. That's how long it takes sound to
cross a medium-sized concert stage. Larger than that and you'd need to
adjust your playing so it sounds in time to audience even in person.

Inside a local network (e.g. in the same building or campus) where
network latencies are below 5 ms, and data limits are usually much
higher, using very small frames, whether Opus or PCM, really pays off.
Over longer distances congestion and limited data rates often mean
you're better off with sending fewer blocks each with more audio, even
when you're splitting your latency budget evenly between the packet
size and the network. And in that case you might as well use Opus.

Of course you should also just try both and see how they work for you.
We designed Opus with live music in mind, so it's great to hear about
successful applications!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xiph.org/pipermail/opus/attachments/20210717/792c547d/attachment.htm>

More information about the opus mailing list