[opus] Multithreaded encoding?

Jean-Marc Valin jmvalin at jmvalin.ca
Tue Mar 31 03:16:48 UTC 2020


You cannot rely on the convergence feature because the format won't let 
you say "cross-fade between these two sub-streams". So you won't be able 
to create a regular file using that technique.

That being said, there *is* a way to force a perfect cross-fade by using 
independent frames. libopusenc is able to use the feature to create 
perfect chained files, which is similar to (but not the same as) your 
problem. So the bottom line is that it's possible, but it's a lot of 
work and I'm not aware of anyone working on that. As Ralph already 
pointed out, people tend to just code different streams in parallel 
rather than attempt to parallelize a single stream.

Cheers,

	Jean-Marc

On 2020-03-30 22:22, Jesus Cea wrote:
> On 30/3/20 23:17, Ralph Giles wrote:
>> I'm not aware of any other attempts, and there have never been official
>> plans. It's difficult to partition input for opus at anything other than
>> the track level, because of the way the decoder derives its adaptive
>> state from recently-seen audio. I guess cutting together streams with at
>> least an 80ms overlap wouldn't glitch too much?
> 
> According to the Opus standard, after 80 ms the encoding would converge.
> That is, only the previous 80 ms of audio would be needed to get a
> perfectly merged stream. You could play safe and do, lets say, 200 ms
> overlapping.
> 
> For example, read https://wiki.xiph.org/OggOpus .
> 
> Efficiency is quite nice:
> 
> 1 second fragments: 92%
> 10 seconds fragments: 99.2%
> 
>> Most people just encode multiple streams simultaneously if they want
>> better throughput.
> 
> I agree, and that would be my usual approach. But in this particular
> case I only have a stream that needs to be processed as fast as
> possible. Seeing three idle CPU cores hurts my engineer brain :).
> 
> 
> _______________________________________________
> opus mailing list
> opus at xiph.org
> http://lists.xiph.org/mailman/listinfo/opus
> 


More information about the opus mailing list