[Vorbis-dev] Splitting Ogg Vorbis file

Timur Elzhov elzhov at gmail.com
Sun Jun 28 08:37:31 PDT 2009


ogg.k & Conrad, thanks for yours reply.

2009/6/28 Conrad Parker <conrad at metadecks.org>:
> My understanding is that for Vorbis, no data will be produced until
> the third packet is received, so if you're missing the 2 previous
> preroll packets then the output PCM stream will simply be shorter, ie.
> missing the first 2 packets worth of audio (a few hundredths of a
> second).

Well, I tried to insert 2 logging lines in decoding_example.c from
libvrbis examples, the first one is

  fprintf(stderr, "decoding packet no %lld\n", op.packetno);

as we got full data packet from the stream; and second

  fprintf(stderr, "  and have %d samples\n", samples);

after every call of "samples = vorbis_synthesis_pcmout(&vd, &pcm)".
The log looks like:

-----------------------------------------------------------
Bitstream is 2 channel, 44100Hz
Encoded by: Xiph.Org libVorbis I 20050304

decoding packet no 3
  and have 0 samples
decoding packet no 4
  and have 576 samples
  and have 0 samples
decoding packet no 5
  and have 1024 samples
  and have 0 samples
decoding packet no 6
  and have 1024 samples
  and have 0 samples
decoding packet no 7
  and have 1024 samples
  and have 0 samples
  ...
-----------------------------------------------------------

I believe we start from 4th packet (no 3) because of three first are
occupied by Vorbis headers, but from this log pcm samples (namely 576)
seem to appear just *in* second data packet, not *after* them!

Next, I looked at the vcut.c, found there get_blocksize() function,
and logged packet's blocksize too:

  blocksize = 64
  blocksize = 576
  blocksize = 1024
  blocksize = 1024
  blocksize = 1024
  ...

the values are the same as in previous log, except that first data
packet has size of 64 intead of expected 0. Is this allowed?

I probably misunderstand something, but how should I interpret that
packets begin to return decoded samples from second (not third)
packet, and also two first packets *both* have non-zero blocksizes?

Thanks again for your assistance.

--
WBR,
Timur.


More information about the Vorbis-dev mailing list