[whatwg] [mimesniff] Handling container formats like Ogg

Ralph Giles giles at mozilla.com
Tue Nov 27 14:24:57 PST 2012


On 12-11-27 9:19 AM, Gordon P. Hemsley wrote:

> Is it sufficient to sniff just for "application/ogg" and then let the
> UA's Ogg library determine whether or not the contents of the file can
> be handled? (I'm sensing the consensus is yes.)

I think so.

Defining a codec enumerating algorithm and mime type decision tree is
going to be several pages of spec for container formats like Ogg and
Matroska.

As an example, the 'file' tool reads the first codec header present in
an Ogg file, which can be found at a set of fixed offsets. This lets it
get some useful information for a lot of files, especially since it's
RECOMMENDED that primary codecs are listed first. I.e. theora should be
first in a 'video/ogg', opus should be first in an 'audio/ogg; codecs=opus'.

But files can be muxed without following the priority rule and will
still play fine, and there can be a 'skeleton' header in front of the
other codec data, obcuring primary role. Just looking at fixed offsets
isn't sufficient to distinguish audio and video reliably.

IMHO,
 -r



More information about the whatwg mailing list