[Vorbis] libvorbis help

Ralph Giles giles at xiph.org
Fri Feb 9 10:30:14 PST 2007

On Fri, Feb 09, 2007 at 11:20:19AM -0700, Thomas Luce wrote:

> I am trying to take a buffer of PCM audio data, and encode it into a
> vorbis stream without blocking. In other words, the sound data is
> generated dynamically and continuously by my program, and it needs to
> convert this data into an ogg file without disrupting the program.

This takes a couple of pages of code, but is straightforward. I'd 
suggest reading through encoder_example.c, which is included in the
examples directory of the libvorbis source.


You do have to block the data to submit it to the encoder, but that just 
means waiting until you've filled a buffer and then calling into the 
encoder to compress it. Once you've done that and processed any output, 
you can return to your generation loop.

If the encoding delay interferes with another part of your program, 
you'll have to do the vorbisenc calls from a separate thread, but try
the naive approach first and see if it works.

Let us know if you have any more questions,

More information about the Vorbis mailing list