Matt Keys
2021-Jun-14 00:13 UTC
[opus] Is there a latency difference between uncompressed UDP (ie Jacktrip) and Opus?
Hello, I'm trying to find any existing documentation or test results of latency differences between using Opus and uncompressed audio UDP streams such as Jacktrip. I have posted my question to the Jacktrip users group here: https://groups.google.com/g/jacktrip-users/c/xxMlqah1SKw As well as to my general telephony network on LinkedIn here: https://www.linkedin.com/posts/mattkeys_jacktrip-udp-vs-sip-rtp-activity-6809305949031931904-IuGQ 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 welcome suggestions on how to benchmark this latency difference, if any. I was thinking about using jack_iodelay and a loopback between audio in and audio outputs while using baresip + jack + opus. Thanks, Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xiph.org/pipermail/opus/attachments/20210614/f8349f45/attachment-0001.htm>
Ralph Giles
2021-Jul-18 00:31 UTC
[opus] Is there a latency difference between uncompressed UDP (ie Jacktrip) and Opus?
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! FWIW, Ralph -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xiph.org/pipermail/opus/attachments/20210717/792c547d/attachment.htm>
Ulrich Windl
2021-Jul-19 06:11 UTC
[opus] Antw: [EXT] Is there a latency difference between uncompressed UDP (ie Jacktrip) and Opus?
>>> Matt Keys <matt at mattkeys.net> schrieb am 14.06.2021 um 02:13 in Nachricht<BN6PR19MB01149ED066FDBD1AA424C191AF319 at BN6PR19MB0114.namprd19.prod.outlook.com>> Hello, > > I'm trying to find any existing documentation or test results of latency > differences between using Opus and uncompressed audio UDP streams such as > Jacktrip. I have posted my question to the Jacktrip users group here: > > https://groups.google.com/g/jacktrip?users/c/xxMlqah1SKw > > As well as to my general telephony network on LinkedIn here: > >https://www.linkedin.com/posts/mattkeys_jacktrip?udp?vs?sip?rtp?activity?680930594> 9031931904?IuGQ > > 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 guess that delay is irrelevant for streaming, while jitter is not. However with enough buffering I guess any distance will do. Also the latency difference between Opus and UDP will become irrelevant as sonn as the network delay exceeds some limit. Maybe explain what your problem really is. Regards, Ulrich> > I welcome suggestions on how to benchmark this latency difference, if any. I> was thinking about using jack_iodelay and a loopback between audio in and > audio outputs while using baresip + jack + opus. > > Thanks, > Matt