[Vorbis] metadata

Ian Malone ibm21 at cam.ac.uk
Sun Oct 2 09:31:54 PDT 2005


Ralph Giles wrote:
 > On Wed, Sep 28, 2005 at 04:14:03PM +0100, Ian Malone wrote:
 >
 >
 >>>Metadata OTOH:
 >>>I'll have to read the Ogg description.  My understanding is that
 >>>is possible to drop in a raw (preferably utf-8) XML document as a
 >>>single page of a separate stream to the Vorbis data (and check that
 >>
 >>         ^^^^              ^
 >>         packet            logical
 >
 >
 > yes, separate logical stream in a group.
 >
 > Right, not a single page. But not really a single packet either.
 > Certainly you want everything at the beginning of the stream, though
 > there are other models: CMML distributes time-associated metadata
 > throughout the stream, in part so you can create it live.
 >
 > The best thing to do is to put the doctype and any single toplevel
 > element in the first packet for stream id, followed by the rest of
 > the  doc using the streaming xml rules (a la XMPP) so if any packet
 > is missing (except for the eos, which it must be possible to
 > regenerate)  you still have a valid xml document. So two or three
 > packets, and however many pages that works out to (but at least 2).
 >

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.

[ian at localhost ~]$ ogginfo var/coding/ogg-tests/page_io/coldplay_out.ogg
Processing file "var/coding/ogg-tests/page_io/coldplay_out.ogg"...

New logical stream (#1, serial: 2f555d0b): type vorbis
New logical stream (#2, serial: 373f4a68): type unknown
Logical stream 2 ended

... and the rest is the normal report for stream 1.  So far so good.

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've seen this discussed at:
<http://lists.xiph.org/pipermail/vorbis-dev/2004-September/017664.html>
But I didn't do anything to the packets, just took them from
ogg_stream_packetout and put them into ogg_stream_packetin.  I even
tried deep copying them in case something was happening behind the
scenes.  Does libvorbisenc know something about how the packets will
get packed into pages?

Anyway, to continue:

 >
 >>"The Ogg/Vorbis I specification currently dictates that Ogg/Vorbis
 >>streams use Ogg transport streams in degenerate, unmultiplexed form
 >>only."
 >>
 >>Should I test and see what happens?  Assuming current players use
 >>libogg, will they see separate logical streams?  I'd imagine even
 >>if they don't have problems with that, a meta-header will break
 >>things.
 >
 >
 > Yes, this is a serious issue. I've always considered this a spec bug.
 > Basically, libvorbisfile needs to be rewritten to support multiplexed
 > streams, and no player that currently uses it will handle these files.
 > What happened is, we broke the spec by adding the above out instead
 > of fixing vorbisfile for the 1.0 release. So Ogg allows it, but the
 > Vorbis spec allows one to not implement it.
 >
 > On a more positive note, now that theora is around many players are
 > writing real Ogg muxers, so it will work properly with something using
 > for example GStreamer, Helix or the DirectShow filters. There's nothing
 > to be done but push the upgrade through, I think.
 >

A summary of the players I've tried so far follows.  The one that would
worry me is the flash player (iAudio G3); I don't think hardware player
manufacturers are going to be very keen on implementing something that's
not in the spec (and Vorbis doesn't help itself if it's a moving
target).

vorbiscomment and the XMMS comment editor both have a habit of stripping
the xml stream out.  The majority of Linux tools manage with various
levels of comment or complaint but none of the Windows ones do.

I suspect Helix simply doesn't know what to do with the stream, that
may be the case for some of the Windows players too.  Helix was happy
if I put the xml bos further on in the stream, but that's not allowed
by the standard.

Mplayer-linux (plays):
[Ogg] stream 0: audio (Vorbis), -aid 0
Ogg stream 1 is of an unknown type
Ogg file format detected.

Xine-linux:
Plays without complaint.  --verbose=2 gives (among other things):
xine: found demuxer plugin: OGG demux plugin
...and...
load_plugins: plugin vorbis will be used for audio streamtype 09.
demux_ogg: unknown stream type (signature ><?xml ve<). hex dump of bos
packet follows:
---------------------------------------------------------------------
0000 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 27 31 <?xml version='1
0010 2E 30 27 3F 3E 0A 3C 73 74 72 65 61 6D 3A 73 74 .0'?>.<stream:st
0020 72 65 61 6D 3E 0A 00                            ream>..
---------------------------------------------------------------------

ogg123-linux (plays):
=== Vorbis library reported a stream error.

xmms:
plays, no complaints

noatun:
loops trying to start play

Rhythmbox:
plays, no problems

Helix&Real Player-linux (doesn't play):
General error: HXR_UNEXPECTED (0x80040009)
(file:///home/ian/var/coding/ogg-tests/page_io/coldplay_out.ogg)

Kaboodle:
Exits

Vorbisgain:
segfaults on opening

oggdec-linux (output .wav files cmp fine):
Warning: hole in data

sox&play - linux:
End without comment; play doesn't and sox writes wav header only.

iAudio G3, firmware 1.30e:
Crash and restart.

Winamp 5.something:
doesn't play

Foobar2000:
doesn't play, console no different to successful play

Windows Media Player with illuminable plugin:
WMP crash and error report to MS

Computer crashed during testing on Winamp, but I don't know if
it was caused by Winamp, WMP, Foobar or general Windows malaise.

-- 
imalone
-------------- next part --------------
[ian at localhost page_io]$ hexdump -C coldplay_out.ogg |head -n20
00000000  4f 67 67 53 00 02 00 00  00 00 00 00 00 00 0b 5d  |OggS...........]|
00000010  55 2f 00 00 00 00 87 95  17 a0 01 1e 01 76 6f 72  |U/...........vor|
00000020  62 69 73 00 00 00 00 02  44 ac 00 00 00 00 00 00  |bis.....D.......|
00000030  03 71 02 00 00 00 00 00  b8 01 4f 67 67 53 00 02  |.q........OggS..|
00000040  00 00 00 00 00 00 00 00  68 4a 3f 37 00 00 00 00  |........hJ?7....|
00000050  27 3e f2 f6 01 27 3c 3f  78 6d 6c 20 76 65 72 73  |'>...'<?xml vers|
00000060  69 6f 6e 3d 27 31 2e 30  27 3f 3e 0a 3c 73 74 72  |ion='1.0'?>.<str|
00000070  65 61 6d 3a 73 74 72 65  61 6d 3e 0a 00 4f 67 67  |eam:stream>..Ogg|
00000080  53 00 04 00 00 00 00 00  00 00 00 68 4a 3f 37 01  |S..........hJ?7.|
00000090  00 00 00 cb 40 42 7b 03  32 3b 0a 3c 62 6f 64 79  |.... at B{.2;.<body|
000000a0  3e 41 72 74 20 74 68 6f  75 20 6e 6f 74 20 52 6f  |>Art thou not Ro|
000000b0  6d 65 6f 2c 20 61 6e 64  20 61 20 4d 6f 6e 74 61  |meo, and a Monta|
000000c0  67 75 65 3f 3c 2f 62 6f  64 79 3e 0a 00 3c 62 6f  |gue?</body>..<bo|
000000d0  64 79 3e 4e 65 69 74 68  65 72 2c 20 66 61 69 72  |dy>Neither, fair|
000000e0  20 73 61 69 6e 74 2c 20  69 66 20 65 69 74 68 65  | saint, if eithe|
000000f0  72 20 74 68 65 65 20 64  69 73 6c 69 6b 65 2e 3c  |r thee dislike.<|
00000100  2f 62 6f 64 79 3e 0a 00  3c 2f 73 74 72 65 61 6d  |/body>..</stream|
00000110  3e 00 4f 67 67 53 00 00  00 00 00 00 00 00 00 00  |>.OggS..........|
00000120  0b 5d 55 2f 01 00 00 00  6a 8f 37 69 11 ff 2c ff  |.]U/....j.7i..,.|
00000130  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff 03 76  |...............v|


More information about the Vorbis mailing list