[opus] preskip and seeking suing Opus
giles at thaumas.net
Thu Aug 15 05:30:06 PDT 2013
On 13-08-14 10:09 PM, Bob Estes wrote:
> I've been studying the Opus code and documentation for a while and have
> seen it mentioned several times that Opus uses pre-skip to allow the
> codec to converge. What convergence are they referring to? Rate
> control? Energy envelope prediction after seeking?
Not rate control, but there are a number of predictors running in the
decoder which need some amount of data to converge with their expected
values when the encoder and decoder would be out of sync for whatever
Pre-skip can be used by a muxer to describe how much data must be run
through the decoder before valid output is obtained at the start of a
file. This could be e.g. 80 ms if the muxer is creating a file from the
middle of another one (lossless editing, webrtc stream recording).
More commonly it's used to account for resampler and algorithmic delay
so the output can be phase-aligned with the input.
> Also, I'm also interested in the seeking behaviour of the decoder.
> If, say, I want to skip ahead in an Opus bitstream, can I start decoding
> at any intra frame without artifacts?
You must start feeding data to the decoder about 80 ms before the
intended seek point, and discard the output. This is for convergence as
described above, but for seeking you can use the general 80 ms rule as
described in the Ogg Opus draft. This is referred to as pre-roll, and
doesn't need to be specially specified by the muxer like pre-skip since
it's constant and applies to any seek point, not just the start of playback.
Does that help?
More information about the opus