[Vorbis-dev] Missing audio when converting PCM to Ogg

Ian Malone ibmalone at gmail.com
Tue Oct 22 14:28:16 PDT 2013


On 22 October 2013 22:09, Ilya Ganelin <ilganeli at gmail.com> wrote:
> Hello,
>
> I am using the Ogg Vorbis library to encode PCM data into ogg format. The
> conversion seems to work fine with the exception that the first and last
> little bit of audio appears cut off in each converted stream. It's about .25
> seconds that are lost.
>
> I am essentially following the example from here:
> http://svn.xiph.org/trunk/vorbis/examples/encoder_example.c
>
> When I added a "Sleep(5)" between writing the ogg data to file, and clearing
> the ogg/vorbis state structures, the ogg output files were closer in length
> but still seemed somewhat shorter. I figured that I might have been
> interrupting the output but this seems like a hacky way of doing things.
>
> Is there a more proper way of solving this issue?
>

It's very hard to say without seeing the code. What I do know is the
sleep function[1] should not affect a simple procedural program. So,
randomly guessing, I suspect problems with file handling and not
closing the output stream explaining the end of the output file
missing. Not sure about the start.

[1] I assume we do both mean the C function sleep:
#include <unistd.h>

       unsigned int sleep(unsigned int seconds);


-- 
imalone
http://ibmalone.blogspot.co.uk


More information about the Vorbis-dev mailing list