Skip to main content
Topic: Opus gapless and glitchness encoding (Read 8468 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Opus gapless and glitchness encoding

Reply #51
Conclusions so far from discussion with jmvalin:

1) The correct way to handle this is to do the split in libopusenc. This will be gapless and glitchless. Everything else is going to be some kind of workaround that can still fail for pathological samples.

2) The signal in this file behaves badly in digital filters when they assume the signal before/after they operate is 0 (this is the default). To prevent this, you need to extend the signal, for example with a simple LPC predictor. Opus does this for the *end* of files, but not at the start. (https://github.com/xiph/libopusenc/blob/master/src/opusenc.c#L1147) I confirmed by mixing the Vorbis and Opus encodes that it's the start of the second file that glitches, not the end of the first one.

3) This needs to happen in both the resampler and the encoder. Easiest would be to have the resampler always do it, and feed the extended output to the encoder.

4) Vorbis implements it also for the start of files (https://github.com/xiph/vorbis/blob/ea8b03fce93444cb3cf0131909e15b4f8856e863/lib/block.c#L416) which is why it behaves so well here. (And obviously it can't fail at the resampling step).

 

Re: Opus gapless and glitchness encoding

Reply #52
But why not implement extrapolation also for the start of file in opus, just like in vorbis? Or is it impossible without breaking something?

 
SimplePortal 1.0.0 RC1 © 2008-2019