[vorbis-dev] packet rearranging questions
joshua at haberman.com
Tue Oct 28 22:55:21 PST 2003
Thanks for the reply!
On Tue, 2003-10-28 at 16:27, Michael Smith wrote:
> On Tuesday 28 October 2003 18:49, Joshua Haberman wrote:
> > 1. how exactly will the overlap/add nature of Vorbis packets affect me
> > as I attempt to rearrange them? Is it correct to say that for any
> > Vorbis packet I take from an existing stream (other than the first
> > packet) I must also take the packet preceding it?
> Yes. The reason that the first packet is an exception here is that it produces
> no output audio (because the overlap is _always_ required).
Ahh, I see.
> > 3. I notice that you can get decoders to discard some of the samples
> > from the end of a packet by subtracting from the granulepos the number
> > of samples you want discarded. A similar way to do this for discarding
> > samples from the beginning of a packet (used by vcut) is to set the
> > granulepos to -x, where x is the number of samples you want discarded
> > from the beginning. But will this work in the middle of a stream, where
> > the granulepos should reflect the total sample offset of the stream?
> No, a negative granulepos (other than -1) is undefined.
Quoting from http://www.xiph.org/ogg/vorbis/doc/vorbis-ogg.html:
"The granule (PCM) position of the first page need not indicate that the
stream started at position zero. Although the granule position belongs
to the last completed packet on the page and a valid granule position
must be positive, by inference it may indicate that the PCM position of
the beginning of audio is positive or negative.
"* A negative value indicates that output samples preceeding time zero
should be discarded during decoding; this technique is used to allow
sample-granularity editing of the stream start time of already-encoded
Vorbis streams. The number of samples to be discarded must not exceed
the overlap-add span of the first two audio packets."
> This only works at the beginning and end of stream, never in the middle.
Bummer. I suppose this will force me to create lots of logical
bitstreams concatenated inside a physical bitstream to accomplish my
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev