[vorbis] file(1) magic for Ogg Vorbis

Monty xiphmont at xiph.org
Sat Jun 23 14:35:53 PDT 2001

On Sun, Jun 17, 2001 at 12:40:53PM +0300, Beni Cherniavsky wrote:
> I downloaded `file' for djgpp, and it verbosly identified my mp3 by
> bitrate, sample rate, mono/stereo, option bits, etc.  WAVs are also
> uidentified well.  Only vorbis was identified simply as "Ogg-Vorbis
> compressed sound file" without any info.  So I decided I must fix this to
> replace my aliases that use `od' to read the bitrate and number of
> channels.
> Here is the result (attached).  I need your feedback before sending to the
> maintainer <christos at astron.com>:
> - Magic:
>   + I currently check for Ogg framing of the first page and vorbis headers
> on first and second packets (which are also separate pages).  Should I
> check less/more?

It is sufficient to check the first page/packet.  Second is overkill,
but if you're getting the comments, I guess it can't hurt.

>     * Partial recognition is possible, i.e. Ogg but not vorbis, or first
> vorbis header but no comment header.  What should be printed then?  I
> should probably fix it to print "Ogg data" not just "Ogg" in case it's not
> vorbis.

No official in-stone spec for other codecs yet.  Vorbis I, however,
will always follow the current magic.

>   + I verify the ogg reverion and the encoder version to be 0.  Should I?

Yes, a good idea.

> Is the encoder version checked at the right place at all (first thing
> after `\x01vorbis', before the number of channels)?

Correct.  32 bits, LSB first immediately after \0x01vorbis.

> - I report way too much for the average user.  What would you like too
> see?  I guess the following should be commented out (but left there for
> somebody needing it to turn on):
>   + The "revision 0" and "version 0" messages (the normal case).


>   + Serial number - does anybody care?

Very unlikely.  Advanced usageonly would be my preference. 

>   + The heavy vendor string, probably only the beta number should be
> printed (exact cvs date?).

I'd say make this advanced usage too, really...  This string does not
actually require a specific format and parsing out date will
eventually break.

>   + The "no comments" message (but leave the "%lu comments" for >0).

comments are up to you. :-)

> - Are the beta dates correct?  What was beta1's date?  Any other releases
> you wish to identify?  (I will maintain the entry to track future
> releases.)

20000508 IIRC.  There are more dates floating around from intermediate
CVS versions.

> - Is anything else possible to detect (for the fun of it)?

ample rate, # channels would be the only other thing I'd always print.


--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.

More information about the Vorbis mailing list