[Matroska-devel] Opus in Matroksa Cont.

Moritz Bunkus moritz at bunkus.org
Fri Jul 5 09:06:03 CEST 2013


Hey,

On Sun, Jun 9, 2013 at 10:08 AM, Steve Lhomme <slhomme at matroska.org> wrote:
>
> +  <element name="CodecDelay" level="3" id="0x56AA" type="uinteger"
multiple="0" default="0" minver="4" webm="1">CodecDelay is the delay in
nanoseconds to add to each Block timestamp. The value should be small so
the muxing of tracks with the same actual timestamp are in the same
Cluster.</element>
>

I'm currently implementing proper Opus support for Matroska. Unfortunately
​ I think​
CodecDelay's definition has to be changed. Citing from the Ogg Opus
encapsulation spec[1]:

> A 'pre-skip' field in the ID header (see Section 5.1) signals the  number
of samples whi
c
h SHOULD be skipped (decoded but discarded) at  the beginning of the stream.

and futher below:

> 'PCM sample position' = 'granule position' - 'pre-skip'

So with _our_ definition that says we have to add that value to the
timestamps and that is unsigned there's actually no way to express that an
audio packet corresponds to a video packet with timestamp 0. It also seems
not so say what Opus needs it to say: that a number of samples have to be
dropped because they're simply invalid.

Example:

V1 at 0​, V2 at 40, V3 at 80
A1 at 0, A2 at 20, A3 at 40, A4 at 60, A5 at 80 with CodecDelay 40

Packing the corresponding packets together (as they would have to be during
muxing):

​V1 at 0, V2 at 40, A1 at 0, A2 at 20, V3 at 80

Instead for Opus we would need an arrangement that looked like this:

A1 at 0, A2 at 20, V1 at 0, A3 at 40, A4 at 60, V2 at 40, A5 at 80​

​So either CodecDelay must be a signed integer or the wording must be
changed... but only _adding_ an _unsigned_ value is insufficient for Opus.

Kind regards,
mosu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.matroska.org/pipermail/matroska-devel/attachments/20130705/44233e81/attachment.html>


More information about the Matroska-devel mailing list