[vorbis-dev] Mime Type and Ogg (More)

Ali Abdin aliabdin at aucegypt.edu
Fri Oct 20 12:30:59 PDT 2000



* Ralph Giles (giles at snow.ashlu.bc.ca) wrote at 16:56 on 20/10/00:
> On Thu, 19 Oct 2000, Ali Abdin wrote:
> 
> > You are right. I apologize for not reading/browsing the archive.
> > 
> > I have read/browsed the threads related to 'Mime-type' and 'Header'.
> > 
> > Monty - in one of the threads 
> > (http://www.xiph.org/archives/vorbis-dev/0416.html) you said:
> > 
> > 'Magic to detect Ogg (and detect Ogg/Vorbis) is easy'
> > 
> > The magic to detect Ogg is 'obvious'. But what about the 'Magic to detect 
> > Ogg/Vorbis'.
> > 
> > You also said 'Whipping out docs for this now.' - Where can I find this? 
> > (I couldn't find any details about mime magic in the docs that I looked 
> > in).
> 
> These are both very fair points. I suspect Monty meant the procedures
> we've alreay touched on. And yes, the lack of (promised) documentation is
> annoying. :-/
>  
> > Is there, (or shouldn't there be) an area in the Ogg header to identify 
> > its contents?
> 
> There's been some discussion of this as well, and we do intend some sort
> of 'stream description' substream. My favorite idea is to include along
> with the other general metadata in RDF/XML, but some have suggested a
> simpler binary header. Mostly to avoid the overhead of the parser,
> though I would imagine that's less of an issue than speed for Nautilus.
> 
> Still, there's no room for this data in Ogg except in a substream, so the
> static bytesequence at a firm offset isn't going to happen. Doesn't
> Nautilus provide its own extended attribute system to cache the results if
> filetype determination is slow? Might that be enough? Wouldn't that also
> be a way to implement (in general) file-specific app association like
> Chris has described in MacOS?

Like I said, we could build an algorithmic detection of Ogg Vorbis, but this
would be "unweildy" if every new file format asks us to use an algorithm to
determine mime-type.

The mime magic is a nice simple way of determining mime-type with almost '0'
overhead for the new file format.
 
> > I read some other threads, but only the above two seems to be the most 
> > relevant ones. None of the threads really discussed mime-type/mime-magic 
> > in depth and NONE of them really reached a consensus or a decision about 
> > any particular issue.
> > 
> > Note: this thread has _NOTHING_ to do with the filename extension
> 
> It does from our point of view. In both cases people have written to
> complain that Ogg doesn't make a handy distinction between vorbis-only and
> otherwise within their favored scheme. Both file extensions and mime-magic
> are inadequite for the way Monty designed the format. Why are you
> contemptuous of one but not the other?

Because filename (and/or extension) has nothing to do with mime-type. To
determine the type of file you use mime-type, not extension.

The way MIME works is that you have two methods of detecting mime-type: 1)
Filename extension and 2) Contents of the file.

Obviously, the contents of the file are a much more reliable method (since
anybody can mv/cp the files to anything they wish). Now the contents of the
file can be detected in two ways: 1) A magic number somewhere at the beginning
of the file, or 2) Using an algorithm.

If every file format used an algorithm, it would be slow and unweildy. To
determine the mime-type you would have to pass the file through EACH algorithm
until you found a match.

> Of course, I'm unconvinced of the need to make the distinction at this
> level, so my argument is more that yours is moot than that your suggestion
> have no merit. If that makes sense?

I could implement suggestion '0' and just wait until you guys develop the
video codec. But I think the lack of mime-magic is a flaw. I guess we can only
agree to disagree on this point
 
> To summarize, for Nautilus (and mime-types in general) I'd suggest:
> 
> 0. Just associate .ogg and 'OggS' with application/x-ogg. Hook that up
>    to ogg123 or any other supporting player. This has been our
>    recommended solution.

Accordign to the previous Mime-type thread, Monty said that the "official"
mime-types would be 'audio/x-ogg' and 'video/x-ogg'. I did not manage to find
someone saying something to the cotnrary (until now). 
 
> 1. If in the future it becomes desireable to make audio/audio+visual
>    distictions, run the file through a laucher or an 'ogginfo' utility
>    or embed algorithmic detection yourself. There will be a metadata
>    substream that will let you distinguish, but not cheaply. 
> 
> 2. Associate audio/x-ogg (or better audio/x-oggvorbis) with vorbis at byte
>    29. The bytes immediately before say the data begins at byte 29, so you
>    can use them to reject text. This would be forking the mimetype; I
>    don't know how we feel about that.

yeah, i'd rather not do this.

> Cheers,
>  -ralph

Regards,
Ali

--- >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-dev-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-dev mailing list