xref: /dflybsd-src/contrib/file/magic/Magdir/vorbis (revision 970935fd377c084648da946d7d7e6d0286f5f89a)
1327e51cbSPeter Avalos
2327e51cbSPeter Avalos#------------------------------------------------------------------------------
3*970935fdSSascha Wildner# $File: vorbis,v 1.26 2020/08/22 18:30:55 christos Exp $
4327e51cbSPeter Avalos# vorbis:  file(1) magic for Ogg/Vorbis files
5327e51cbSPeter Avalos#
6327e51cbSPeter Avalos# From Felix von Leitner <leitner@fefe.de>
7327e51cbSPeter Avalos# Extended by Beni Cherniavsky <cben@crosswinds.net>
8327e51cbSPeter Avalos# Further extended by Greg Wooledge <greg@wooledge.org>
9327e51cbSPeter Avalos#
10327e51cbSPeter Avalos# Most (everything but the number of channels and bitrate) is commented
11327e51cbSPeter Avalos# out with `##' as it's not interesting to the average user.  The most
12327e51cbSPeter Avalos# probable things advanced users would want to uncomment are probably
13327e51cbSPeter Avalos# the number of comments and the encoder version.
14327e51cbSPeter Avalos#
1579343712SPeter Avalos# FIXME: The first match has been made a search, so that it can skip
1679343712SPeter Avalos# over prepended ID3 tags. This will work for MIME type detection, but
1779343712SPeter Avalos# won't work for detecting other properties of the file (they all need
1879343712SPeter Avalos# to be made relative to the search). In any case, if the file has ID3
1979343712SPeter Avalos# tags, the ID3 information will be printed, not the Ogg information,
2079343712SPeter Avalos# so until that's fixed, this doesn't matter.
2179343712SPeter Avalos# FIXME[2]: Disable the above for now, since search assumes text mode.
2279343712SPeter Avalos#
23327e51cbSPeter Avalos# --- Ogg Framing ---
2479343712SPeter Avalos#0		search/1000	OggS		Ogg data
25327e51cbSPeter Avalos0		string	OggS		Ogg data
26327e51cbSPeter Avalos>4		byte		!0		UNKNOWN REVISION %u
27327e51cbSPeter Avalos##>4		byte		0		revision 0
28327e51cbSPeter Avalos>4		byte		0
29327e51cbSPeter Avalos##>>14		lelong		x		(Serial %lX)
30327e51cbSPeter Avalos# non-Vorbis content: FLAC (Free Lossless Audio Codec, http://flac.sourceforge.net)
3179343712SPeter Avalos>>28		string		\x7fFLAC	\b, FLAC audio
32327e51cbSPeter Avalos# non-Vorbis content: Theora
3382c5fa3eSPeter Avalos!:mime		audio/ogg
34327e51cbSPeter Avalos>>28		string		\x80theora	\b, Theora video
3582c5fa3eSPeter Avalos!:mime		video/ogg
3679343712SPeter Avalos# non-Vorbis content: Kate
3782c5fa3eSPeter Avalos>>28		string		\x80kate\0\0\0\0	\b, Kate (Karaoke and Text)
3882c5fa3eSPeter Avalos!:mime		application/ogg
3979343712SPeter Avalos>>>37		ubyte		x		v%u
4079343712SPeter Avalos>>>38		ubyte		x		\b.%u,
4179343712SPeter Avalos>>>40		byte		0		utf8 encoding,
4279343712SPeter Avalos>>>40		byte		!0		unknown character encoding,
4379343712SPeter Avalos>>>60		string		>\0		language %s,
4479343712SPeter Avalos>>>60		string		\0		no language set,
4579343712SPeter Avalos>>>76		string		>\0		category %s
4679343712SPeter Avalos>>>76		string		\0		no category set
4779343712SPeter Avalos# non-Vorbis content: Skeleton
4879343712SPeter Avalos>>28		string		fishead\0	\b, Skeleton
4982c5fa3eSPeter Avalos!:mime		video/ogg
50c30bd091SSascha Wildner>>>36		leshort		x		v%u
51c30bd091SSascha Wildner>>>40		leshort		x		\b.%u
52327e51cbSPeter Avalos# non-Vorbis content: Speex
53327e51cbSPeter Avalos>>28		string		Speex\ \ \ 	\b, Speex audio
5482c5fa3eSPeter Avalos!:mime		audio/ogg
55327e51cbSPeter Avalos# non-Vorbis content: OGM
56327e51cbSPeter Avalos>>28		string		\x01video\0\0\0	\b, OGM video
5782c5fa3eSPeter Avalos!:mime		video/ogg
58327e51cbSPeter Avalos>>>37		string/c	div3		(DivX 3)
59327e51cbSPeter Avalos>>>37		string/c	divx		(DivX 4)
60327e51cbSPeter Avalos>>>37		string/c	dx50		(DivX 5)
61327e51cbSPeter Avalos>>>37		string/c	xvid		(XviD)
62327e51cbSPeter Avalos# --- First vorbis packet - general header ---
63327e51cbSPeter Avalos>>28		string		\x01vorbis	\b, Vorbis audio,
6482c5fa3eSPeter Avalos!:mime		audio/ogg
6582c5fa3eSPeter Avalos>>>35		lelong		!0		UNKNOWN VERSION %u,
66327e51cbSPeter Avalos##>>>35		lelong		0		version 0,
67327e51cbSPeter Avalos>>>35		lelong		0
68327e51cbSPeter Avalos>>>>39		ubyte		1		mono,
69327e51cbSPeter Avalos>>>>39		ubyte		2		stereo,
70327e51cbSPeter Avalos>>>>39		ubyte		>2		%u channels,
7182c5fa3eSPeter Avalos>>>>40		lelong		x		%u Hz
72327e51cbSPeter Avalos# Minimal, nominal and maximal bitrates specified when encoding
73327e51cbSPeter Avalos>>>>48		string		<\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff	\b,
74327e51cbSPeter Avalos# The above tests if at least one of these is specified:
75327e51cbSPeter Avalos>>>>>52		lelong		!-1
76327e51cbSPeter Avalos# Vorbis RC2 has a bug which puts -1000 in the min/max bitrate fields
77327e51cbSPeter Avalos# instead of -1.
78327e51cbSPeter Avalos# Vorbis 1.0 uses 0 instead of -1.
79327e51cbSPeter Avalos>>>>>>52	lelong		!0
80327e51cbSPeter Avalos>>>>>>>52	lelong		!-1000
8182c5fa3eSPeter Avalos>>>>>>>>52	lelong		x		<%u
82327e51cbSPeter Avalos>>>>>48		lelong		!-1
8382c5fa3eSPeter Avalos>>>>>>48	lelong		x		~%u
84327e51cbSPeter Avalos>>>>>44		lelong		!-1
85327e51cbSPeter Avalos>>>>>>44	lelong		!-1000
86327e51cbSPeter Avalos>>>>>>>44	lelong		!0
8782c5fa3eSPeter Avalos>>>>>>>>44	lelong		x		>%u
88327e51cbSPeter Avalos>>>>>48		string		<\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff	bps
89327e51cbSPeter Avalos# -- Second vorbis header packet - the comments
90327e51cbSPeter Avalos# A kludge to read the vendor string.  It's a counted string, not a
91327e51cbSPeter Avalos# zero-terminated one, so file(1) can't read it in a generic way.
92327e51cbSPeter Avalos# libVorbis is the only one existing currently, so I detect specifically
93327e51cbSPeter Avalos# it.  The interesting value is the cvs date (8 digits decimal).
94327e51cbSPeter Avalos# Post-RC1 Ogg files have the second header packet (and thus the version)
95327e51cbSPeter Avalos# in a different place, so we must use an indirect offset.
96327e51cbSPeter Avalos>>>(84.b+85)		string		\x03vorbis
97327e51cbSPeter Avalos>>>>(84.b+96)		string/c	Xiphophorus\ libVorbis\ I	\b, created by: Xiphophorus libVorbis I
98327e51cbSPeter Avalos>>>>>(84.b+120)		string		>00000000
99327e51cbSPeter Avalos# Map to beta version numbers:
100327e51cbSPeter Avalos>>>>>>(84.b+120)	string		<20000508	(<beta1, prepublic)
101327e51cbSPeter Avalos>>>>>>(84.b+120)	string		20000508	(1.0 beta 1 or beta 2)
102327e51cbSPeter Avalos>>>>>>(84.b+120)	string		>20000508
103327e51cbSPeter Avalos>>>>>>>(84.b+120)	string		<20001031	(beta2-3)
104327e51cbSPeter Avalos>>>>>>(84.b+120)	string		20001031	(1.0 beta 3)
105327e51cbSPeter Avalos>>>>>>(84.b+120)	string		>20001031
106327e51cbSPeter Avalos>>>>>>>(84.b+120)	string		<20010225	(beta3-4)
107327e51cbSPeter Avalos>>>>>>(84.b+120)	string		20010225	(1.0 beta 4)
108327e51cbSPeter Avalos>>>>>>(84.b+120)	string		>20010225
109327e51cbSPeter Avalos>>>>>>>(84.b+120)	string		<20010615	(beta4-RC1)
110327e51cbSPeter Avalos>>>>>>(84.b+120)	string		20010615	(1.0 RC1)
111327e51cbSPeter Avalos>>>>>>(84.b+120)	string		20010813	(1.0 RC2)
112327e51cbSPeter Avalos>>>>>>(84.b+120)	string		20010816	(RC2 - Garf tuned v1)
113327e51cbSPeter Avalos>>>>>>(84.b+120)	string		20011014	(RC2 - Garf tuned v2)
114327e51cbSPeter Avalos>>>>>>(84.b+120)	string		20011217	(1.0 RC3)
115327e51cbSPeter Avalos>>>>>>(84.b+120)	string		20011231	(1.0 RC3)
116327e51cbSPeter Avalos# Some pre-1.0 CVS snapshots still had "Xiphphorus"...
117327e51cbSPeter Avalos>>>>>>(84.b+120)	string		>20011231	(pre-1.0 CVS)
118327e51cbSPeter Avalos# For the 1.0 release, Xiphophorus is replaced by Xiph.Org
119327e51cbSPeter Avalos>>>>(84.b+96)		string/c	Xiph.Org\ libVorbis\ I	\b, created by: Xiph.Org libVorbis I
120327e51cbSPeter Avalos>>>>>(84.b+117)		string		>00000000
121327e51cbSPeter Avalos>>>>>>(84.b+117)	string		<20020717	(pre-1.0 CVS)
122327e51cbSPeter Avalos>>>>>>(84.b+117)	string		20020717	(1.0)
123327e51cbSPeter Avalos>>>>>>(84.b+117)	string		20030909	(1.0.1)
124327e51cbSPeter Avalos>>>>>>(84.b+117)	string		20040629	(1.1.0 RC1)
1256fca56fbSSascha Wildner>>>>>>(84.b+117)	string		20050304	(1.1.2)
1266fca56fbSSascha Wildner>>>>>>(84.b+117)	string		20070622	(1.2.0)
1276fca56fbSSascha Wildner>>>>>>(84.b+117)	string		20090624	(1.2.2)
1286fca56fbSSascha Wildner>>>>>>(84.b+117)	string		20090709	(1.2.3)
1296fca56fbSSascha Wildner>>>>>>(84.b+117)	string		20100325	(1.3.1)
1306fca56fbSSascha Wildner>>>>>>(84.b+117)	string		20101101	(1.3.2)
1316fca56fbSSascha Wildner>>>>>>(84.b+117)	string		20120203	(1.3.3)
1326fca56fbSSascha Wildner>>>>>>(84.b+117)	string		20140122	(1.3.4)
1336fca56fbSSascha Wildner>>>>>>(84.b+117)	string		20150105	(1.3.5)
134c30bd091SSascha Wildner
135*970935fdSSascha Wildner# non-Vorbis content: Opus https://tools.ietf.org/html/rfc7845#section-5
136c30bd091SSascha Wildner>>28		string		OpusHead	\b, Opus audio,
137c30bd091SSascha Wildner!:mime		audio/ogg
138c30bd091SSascha Wildner>>>36		ubyte		>0x0F		UNKNOWN VERSION %u,
139*970935fdSSascha Wildner>>>36		ubyte&0x0F	!0		version 0.%u,
140c30bd091SSascha Wildner>>>>46		ubyte		>1
141c30bd091SSascha Wildner>>>>>46		ubyte		!255		unknown channel mapping family %u,
142c30bd091SSascha Wildner>>>>>37		ubyte		x		%u channels
143c30bd091SSascha Wildner>>>>46		ubyte		0
144c30bd091SSascha Wildner>>>>>37		ubyte		1		mono
145c30bd091SSascha Wildner>>>>>37		ubyte		2		stereo
146c30bd091SSascha Wildner>>>>46		ubyte		1
147c30bd091SSascha Wildner>>>>>37		ubyte		1		mono
148c30bd091SSascha Wildner>>>>>37		ubyte		2		stereo
149c30bd091SSascha Wildner>>>>>37		ubyte		3		linear surround
150c30bd091SSascha Wildner>>>>>37		ubyte		4		quadraphonic
151c30bd091SSascha Wildner>>>>>37		ubyte		5		5.0 surround
152c30bd091SSascha Wildner>>>>>37		ubyte		6		5.1 surround
153c30bd091SSascha Wildner>>>>>37		ubyte		7		6.1 surround
154c30bd091SSascha Wildner>>>>>37		ubyte		8		7.1 surround
155*970935fdSSascha Wildner>>>>40		lelong		!0		\b, %u Hz (Input Sample Rate)