[Vorbis] metadata

Ralph Giles giles at xiph.org
Sun Oct 2 09:52:34 PDT 2005


On Sun, Oct 02, 2005 at 05:31:54PM +0100, Ian Malone wrote:

> Okay, I've rigged up a simple test with the following four packets:
> char *xmlpacket[4] = {
>   "<?xml version='1.0'?>\n<stream:stream>\n",
>   "<body>Art thou not Romeo, and a Montague?</body>\n",
>   "<body>Neither, fair saint, if either thee dislike.</body>\n",
>   "</stream>"
> };
> 
> And loaded these into an Ogg-Vorbis file immediately after the
> Vorbis b.o.s page (With the b_o_s and e_o_s set appropriately,
> granulepos 0 for all).  A hex dump up to the xml eos is
> attached.  Testing with XMMS I found it would refuse to play if
> the xml stream header came first.

Well, that's good news. I thought it might succeed in 'accidentally'
working with vorbisfile in some cases.

The first xml page should definitely go after the vorbis bos. The
rule of thumb is that the dominant media type goes first so file
magic can identify the stream. So an Ogg Vorbis file, even with
metadata, subtitles, etc, should start with the vorbis bos.

Also, I think vorbisfile expects the first page it gets to be
the vorbis stream.

> As an aside, while I was playing with libogg, I tried copying a file
> packet-by-packet, the result passed through ogginfo gave:
> "Negative granulepos on vorbis stream outside of headers. This file
> was created by a buggy encoder."

I expect what's happening is that when vorbisenc produces the initial 
packet stream it sets a granulepos on every packet; libogg trusts these.
But what you get from ogg_stream_packetout() only has the granulepos
set on periodic packets, and this confuses the granulepos choice logic
(or it just splits the packet stream at different points) in libogg,
so you end up with *pages* marked with a granulepos of -1.

Note that Conrad Parker's liboggz has code for repacketizing if you
want something quick to do this (or an example of how to handle it).

> A summary of the players I've tried so far follows.

Thanks for the summary. Too bad about helix. They have a real Ogg mux 
though (and handle theora) so it should be straightforward to add the
type and/or ignore unknown stream types.

Otherwise, it looks like for vorbisfile-based players it depends on
how the error handling is implemented.

 -r


More information about the Vorbis mailing list