[vorbis-dev] How do i decrease the encoder buffer size?

Michael Smith msmith at labyrinth.net.au
Tue Jul 9 02:27:56 PDT 2002



At 11:27 PM 7/8/02 -0400, you wrote:
>My goal is better synchronization of recorded audio content with other live 
>content like images from a webcam.
>I imagine that the more frequently I receive audio buffers from the 
>encoder, the more accurate the synchronization would be.

Although you can reduce the buffer used on the output (i.e. the 4 kB ogg
page buffer size) simply by flushing the ogg stream when you decide you
want to, you can't reduce the encoder's internal buffers - and those can be
very large (often larger than the ogg page buffers).

However, ogg and vorbis provide all the information you need to do
very accurate synchronisation elsewhere. Each packet (when produced by
libvorbis - this information isn't explicitly retained in ogg, but can
be reproduced easily enough) and each page (explicitly) has an absolute
time offset (in samples). Using this as your timebase (using audio rather
than video for a sync timebase is normal), you can synchronise as 
accurately as you want at the decode end - if you need sub-page accurate
time information (i.e. you want granulepos on each packet), it can be
recalculated (usually. If you have a 'hole' - i.e. a sequence number
gap in the pages, it's more difficult) very easily by using the
vorbis_packet_blocksize() function and the related information in the
vorbis_info struct (for the actual block sizes).

Michael

<p>>
>Thanks.
>
>At 11:06 PM 7/8/2002 -0400, you wrote:
>
>
>
>>On Mon, Jul 08, 2002 at 06:45:43PM -0400, Kendal wrote:
>> > I am feeding the Ogg encoder linear audio data, and oggStream.pageOut(
>> > oggPage ) != 0 informs me when there is a block of bytes ready in the
>> > encoder. These blocks of bytes are typically about 4k long. Is it possible
>> > that I reduce that size to 1k?  What would i have to change?
>>
>>What are you really trying to do?  Depending on that, the answer is
>>either no or maybe.
>>
>>Also please do not reply to existing threads with unrelated
>>questions.  You're lucky that I'd missed marking this one
>>'closed/uninteresting'.
>>
>>Monty
>>
>>--- >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.
>
>
>--- >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.
>

--- >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 mailing list