2003-01-07 21:00:00 +00:00
|
|
|
Mimetypes in GStreamer
|
|
|
|
======================
|
|
|
|
|
|
|
|
1) What is a mimetype
|
|
|
|
---------------------
|
|
|
|
A mimetype is a combination of two (short) strings (words), the content
|
|
|
|
type and the content subtype, that make up a pair that describes a file
|
|
|
|
content type. In multimedia, mime types are used to describe the media
|
|
|
|
streamtype . In GStreamer, obsiously, we use mimetypes in the same way.
|
|
|
|
They are part of a GstCaps, that describes a media stream. Besides a
|
|
|
|
mimetype, a GstCaps also contains stream properties (GstProps), which
|
|
|
|
are combinations of key/value pairs, and a name.
|
|
|
|
|
|
|
|
An example of a mimetype is 'video/mpeg'. A corresponding GstCaps could
|
|
|
|
be created using:
|
|
|
|
GstCaps *caps = gst_caps_new("video_mpeg_type",
|
|
|
|
"video/mpeg",
|
|
|
|
gst_props_new("width", GST_PROPS_INT(384),
|
|
|
|
"height", GST_PROPS_INT(288),
|
|
|
|
NULL));
|
2003-06-06 23:49:25 +00:00
|
|
|
or using a macro:
|
|
|
|
GstCaps *caps = GST_CAPS_NEW("video_mpeg_type",
|
|
|
|
"video/mpeg",
|
|
|
|
"width", GST_PROPS_INT(384),
|
|
|
|
"height", GST_PROPS_INT(288)
|
|
|
|
);
|
2003-01-07 21:00:00 +00:00
|
|
|
|
|
|
|
Obviously, mimetypes and their corresponding properties are of major
|
|
|
|
importance in GStreamer for uniquely identifying media streams.
|
|
|
|
|
|
|
|
2) The problems
|
|
|
|
---------------
|
|
|
|
Some streams may have mimetypes or GstCaps that do not fully describe
|
|
|
|
the stream. In most cases, this is not a problem, though. For a stream
|
|
|
|
that contains Ogg/Vorbis data, we don't need to know the samplerate of
|
|
|
|
the raw audio stream, for example, since we can't play it back anyway.
|
|
|
|
The samplerate _is_ important for _raw_ audio, so a decoder would need
|
|
|
|
to retrieve the samplerate from the Ogg/Vorbis stream headers (that are
|
|
|
|
part of the bytestream) in order to pass it on in the GstCaps that
|
|
|
|
belongs to the decoded audio ('audio/raw').
|
2003-06-06 23:49:25 +00:00
|
|
|
However, other plugins *might* want to know such properties, even for
|
|
|
|
compressed streams. One such example is an AVI muxer, which does want
|
|
|
|
to know the samplerate of an audio stream, even when it is compressed.
|
2003-01-07 21:00:00 +00:00
|
|
|
|
|
|
|
Another problem is that many media types can be defined in multiple ways.
|
|
|
|
For example, MJPEG video can be defined as video/jpeg, video/mjpeg,
|
|
|
|
image/jpeg, video/avi with a compression of (fourcc) MJPG, etc. None of
|
|
|
|
these is really official, since there isn't an official mimetype for
|
|
|
|
encoded MJPEG video.
|
|
|
|
|
|
|
|
The main focus of this document is to propose a standardized set of
|
|
|
|
mimetypes and properties that will be used by the GStreamer plugins.
|
|
|
|
|
|
|
|
3) Different types of streams
|
|
|
|
-----------------------------
|
|
|
|
There are several types of media streams. The most important distinction
|
|
|
|
will be container formats, audio codecs and video codecs. Container
|
|
|
|
formats are bytestreams that contain one or more substreams inside it,
|
|
|
|
and don't provide any direct media data itself. Examples are Quicktime,
|
|
|
|
AVI or MPEG (bytestream). They mostly contain of a set of headers that
|
|
|
|
define the media stream(s) that is packed inside the container and the
|
|
|
|
media data itself.
|
|
|
|
Video codecs and audio codecs describe encoded audio or video data.
|
2003-06-06 23:49:25 +00:00
|
|
|
Examples are MPEG-1 video, DivX video, MPEG-1 layer 3 (MP3) audio or
|
|
|
|
Ogg/Vorbis audio. Actually, Ogg is a container format too (for Vorbis
|
2003-01-07 21:00:00 +00:00
|
|
|
audio), but these are usually used in conjunction with each other.
|
|
|
|
|
|
|
|
3a) Container formats
|
|
|
|
1 - AVI (Microsoft RIFF/AVI)
|
2003-06-20 16:33:54 +00:00
|
|
|
mimetype: video/avi
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
2 - Quicktime (Apple)
|
2003-06-20 16:33:54 +00:00
|
|
|
mimetype: video/quicktime
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
3 - MPEG (MPEG LA)
|
|
|
|
mimetype: video/mpeg
|
2003-01-19 20:05:16 +00:00
|
|
|
properties: 'systemstream' = TRUE (BOOLEAN)
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
4 - ASF (Microsoft)
|
2003-06-20 16:33:54 +00:00
|
|
|
mimetype: video/x-ms-asf
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
5 - WAV (PCM)
|
|
|
|
mimetype: audio/x-wav
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
6 - RealMedia (Real)
|
2003-06-20 16:33:54 +00:00
|
|
|
mimetype: audio/x-pn-realaudio
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
7 - DV (Digital Video)
|
|
|
|
mimetype: video/dv
|
2003-01-19 20:05:16 +00:00
|
|
|
properties: 'systemstream' = TRUE (BOOLEAN)
|
2003-06-06 23:49:25 +00:00
|
|
|
|
|
|
|
8 - Ogg (Xiph)
|
|
|
|
mimetype: application/x-ogg
|
|
|
|
|
|
|
|
9 - Matroska
|
|
|
|
mimetype: video/x-mkv
|
|
|
|
|
2003-06-20 16:33:54 +00:00
|
|
|
10 - Shockwave (Macromedia)
|
|
|
|
mimetype: application/x-shockwave-flash
|
|
|
|
|
2003-06-06 23:49:25 +00:00
|
|
|
Please note that we try to keep these mimetypes as similar as possible
|
|
|
|
to what's used as standard mimetypes in Gnome (Gnome-VFS/Nautilus) and
|
|
|
|
KDE (Konqueror).
|
2003-01-07 21:00:00 +00:00
|
|
|
|
|
|
|
3b) Video codecs
|
|
|
|
For convenience, the fourcc codes used in the AVI container format will be
|
2003-06-06 23:49:25 +00:00
|
|
|
listed along with the mimetype and optional properties.
|
|
|
|
|
|
|
|
Preface - (optional) properties for all video formats:
|
|
|
|
'width' = X (INT)
|
|
|
|
'height' = X (INT)
|
|
|
|
'pixel_width' and 'pixel_height' = X (2xINT, together aspect ratio)
|
2003-05-09 07:55:35 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
1a - Raw Video (YUV/YCbCr)
|
|
|
|
mimetype: video/raw
|
|
|
|
properties: 'format' = 'XXXX' (fourcc)
|
2003-06-06 23:49:25 +00:00
|
|
|
known fourccs: YUY2, I420, Y41P, YVYU, UYVY, etc.
|
2003-05-09 07:55:35 +00:00
|
|
|
|
|
|
|
Note: some raw video formats have implicit alignment rules. We should
|
2003-06-06 23:49:25 +00:00
|
|
|
discuss this more.
|
|
|
|
Note: some formats have multiple fourccs (e.g. IYUV/I420 or YUY2/YUYV).
|
|
|
|
For each of these, we only use one (e.g. I420 and YUY2).
|
2003-05-09 07:55:35 +00:00
|
|
|
|
2003-06-20 16:33:54 +00:00
|
|
|
Currently recognized formats:
|
|
|
|
YUY2: packed, Y-U-Y-V order, U/V hor 2x subsampled (YUV-4:2:2, 16 bpp)
|
|
|
|
YVYU: packed, Y-V-Y-U order, U/V hor 2x subsampled (YUV-4:2:2, 16 bpp)
|
|
|
|
UYVY: packed, U-Y-V-Y order, U/V hor 2x subsampled (YUV-4:2:2, 16 bpp)
|
|
|
|
|
|
|
|
Y42B: planar, Y-U-V order, U/V hor 2x subsampled (YUV-4:2:2, 16 bpp)
|
|
|
|
YV12: planar, Y-V-U order, U/V hor+ver 2x subsampled (YUV-4:2:0, 12 bpp)
|
|
|
|
I420: planar, Y-U-V order, U/V hor+ver 2x subsampled (YUV-4:2:0, 12 bpp)
|
|
|
|
Y41B: planar, Y-U-V order, U/V hor 4x subsampled (YUV-4:1:1, 12bpp)
|
|
|
|
YUV9: planar, Y-U-V order, U/V hor+ver 4x subsampled (YUV-4:1:0, 9bpp)
|
|
|
|
YVU9: planar, Y-V-U order, U/V hor+ver 4x subsampled (YUV-4:1:0, 9bpp)
|
|
|
|
|
|
|
|
See http://www.fourcc.org/ for more information.
|
|
|
|
|
|
|
|
Note: YUV-4:4:4 (both planar and packed, in multiple orders) are missing.
|
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
1b - Raw Video (RGB)
|
|
|
|
mimetype: video/raw
|
|
|
|
properties: 'format' = 'RGB ' (fourcc)
|
|
|
|
'endianness' = 1234/4321 (INT) <- endianness
|
2003-05-09 07:55:35 +00:00
|
|
|
'depth' = 15/16/24 (INT) <- bits per pixel (depth)
|
|
|
|
'bpp' = 16/24/32 (INT) <- bits per pixel (in memory)
|
2003-01-19 20:05:16 +00:00
|
|
|
'red_mask' = bitmask (0x..) (INT) <- red pixel mask
|
|
|
|
'green_mask' = bitmask (0x..) (INT) <- green pixel mask
|
|
|
|
'blue_mask' = bitmask (0x..) (INT) <- blue pixel mask
|
2003-05-09 07:55:35 +00:00
|
|
|
|
|
|
|
'bpp' is the number of bits of memory used for each pixel. 'depth'
|
|
|
|
is the color depth.
|
|
|
|
|
|
|
|
24 and 32 bit RGB should always be specified as big endian, since
|
|
|
|
any little endian format can be transformed into big endian by
|
|
|
|
rearranging the color masks. 15 and 16 bit formats should generally
|
|
|
|
have the same byte order as the cpu.
|
|
|
|
|
|
|
|
Color masks are interpreted by loading 'bpp' number of bits using
|
|
|
|
'endianness' rule, and masking and shifting by each color mask.
|
|
|
|
Loading a 24-bit value cannot be done directly, but one can perform
|
|
|
|
an equivalent operation.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
msb .. lsb
|
|
|
|
- memory: RRRRRRRR GGGGGGGG BBBBBBBB RRRRRRRR GGGGGGGG ...
|
|
|
|
'bpp' = 24
|
|
|
|
'depth' = 24
|
|
|
|
'endianness' = 4321 (G_BIG_ENDIAN)
|
|
|
|
'red_mask' = 0xff0000
|
|
|
|
'green_mask' = 0x00ff00
|
|
|
|
'blue_mask' = 0x0000ff
|
|
|
|
|
|
|
|
- memory: xRRRRRGG GGGBBBBB xRRRRRGG GGGBBBBB xRRRRRGG ...
|
|
|
|
'bpp' = 16
|
|
|
|
'depth' = 15
|
|
|
|
'endianness' = 4321 (G_BIG_ENDIAN)
|
|
|
|
'red_mask' = 0x7c00
|
|
|
|
'green_mask' = 0x03e0
|
|
|
|
'blue_mask' = 0x003f
|
|
|
|
|
|
|
|
- memory: GGGBBBBB xRRRRRGG GGGBBBBB xRRRRRGG GGGBBBBB ...
|
|
|
|
'bpp' = 16
|
|
|
|
'depth' = 15
|
|
|
|
'endianness' = 1234 (G_LITTLE_ENDIAN)
|
|
|
|
'red_mask' = 0x7c00
|
|
|
|
'green_mask' = 0x03e0
|
|
|
|
'blue_mask' = 0x003f
|
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
2 - MPEG-1, -2 and -4 video (ISO/LA MPEG)
|
|
|
|
mimetype: video/mpeg
|
2003-01-19 20:05:16 +00:00
|
|
|
properties: 'systemstream' = FALSE (BOOLEAN)
|
2003-01-07 21:00:00 +00:00
|
|
|
'mpegversion' = 1/2/4 (INT)
|
|
|
|
known fourccs: MPEG, MPGI
|
2003-06-06 23:49:25 +00:00
|
|
|
|
|
|
|
3 - DivX 3.x, 4.x and 5.x video
|
2003-01-07 21:00:00 +00:00
|
|
|
mimetype: video/divx
|
2003-06-06 23:49:25 +00:00
|
|
|
optional properties: 'divxversion' = 3/4/5 (INT)
|
2003-01-07 21:00:00 +00:00
|
|
|
known fourccs: DIV3, DIV4, DIV5, DIVX, DX50, DIVX, divx
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
4 - Microsoft MPEG 4.1, 4.2 and 4.3
|
|
|
|
mimetype: video/x-msmpeg
|
2003-06-06 23:49:25 +00:00
|
|
|
optional properties: 'mpegversion' = 41/42/43 (INT)
|
2003-01-07 21:00:00 +00:00
|
|
|
known fourccs: MPG4, MP42, MP43
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
5 - Motion-JPEG (official and extended)
|
|
|
|
mimetype: video/jpeg
|
|
|
|
known fourccs: MJPG (YUY2 MJPEG), JPEG (any), PIXL (Pinnacle/Miro), VIXL
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
6 - Sorensen (Quicktime - SVQ1/SVQ3)
|
|
|
|
mimetypes: video/x-svq
|
|
|
|
properties: 'svqversion' = 1/3 (INT)
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
7 - H263 and related codecs
|
|
|
|
mimetype: video/h263
|
|
|
|
known fourccs: H263, i263, M263, x263, VDOW, VIVO
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
8 - RealVideo (Real)
|
|
|
|
mimetype: video/realvideo
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
9 - Digital Video (DV)
|
|
|
|
mimetype: video/dv
|
2003-01-19 20:05:16 +00:00
|
|
|
properties: 'systemstream' = FALSE (BOOLEAN)
|
2003-01-07 21:00:00 +00:00
|
|
|
known fourccs: DVSD, dvsd
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
10 - Windows Media Video 1 and 2 (WMV)
|
|
|
|
mimetype: video/wmv
|
|
|
|
properties: 'wmvversion' = 1/2 (INT)
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
11 - XviD
|
|
|
|
mimetype: video/xvid
|
|
|
|
known fourccs: xvid, XVID
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
12 - 3IVX
|
|
|
|
mimetype: video/3ivx
|
|
|
|
known fourccs: 3IV1, 3IV2
|
2003-06-06 23:49:25 +00:00
|
|
|
|
|
|
|
13 - Ogg/Tarkin (Xiph)
|
|
|
|
mimetype: video/x-tarkin
|
|
|
|
|
|
|
|
15 - VP3
|
|
|
|
mimetype: video/vp3
|
|
|
|
|
|
|
|
15 - Ogg/Theora (Xiph, VP3-like)
|
|
|
|
mimetype: video/x-theora
|
|
|
|
|
|
|
|
16 - Huffyuv
|
2003-01-07 21:02:20 +00:00
|
|
|
mimetype: video/x-huffyuv
|
|
|
|
known fourccs: HFYU
|
2003-01-07 21:00:00 +00:00
|
|
|
|
2003-06-06 23:49:25 +00:00
|
|
|
TODO: colorspace identifications for MJPEG? How? Move MPEG4-compatible codecs
|
|
|
|
over to video/mpeg with a subtype (xvid, divx3, divx4, divx5, iso, ...)?
|
|
|
|
interlacing?
|
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
3c) Audio Codecs
|
|
|
|
for convenience, the two-byte hexcodes (as are being used for identification
|
|
|
|
in AVI files) are also given
|
2003-06-06 23:49:25 +00:00
|
|
|
|
|
|
|
Preface - (optional) properties for all audio formats:
|
2003-06-20 16:39:21 +00:00
|
|
|
'rate' = X (int) <- sampling rate
|
|
|
|
'channels' = X (int) <- number of audio channels
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
1 - Raw Audio
|
|
|
|
mimetype: audio/raw
|
2003-06-20 16:39:21 +00:00
|
|
|
properties: 'width' = X (INT) <- memory bits per sample
|
2003-06-06 23:49:25 +00:00
|
|
|
'depth' = X (INT) <- used bits per sample
|
2003-01-07 21:00:00 +00:00
|
|
|
'law' = 0/1/2 (INT) <- no law (0), alaw (1) or mulaw (2)
|
|
|
|
'signedness' = X (BOOLEAN)
|
|
|
|
'endianness' = 1234/4321 <- endianness of audio stream
|
2003-06-06 23:49:25 +00:00
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
2 - MPEG-1 layer 1/2/3 audio
|
2003-06-06 23:49:25 +00:00
|
|
|
mimetype: audio/x-mp3
|
|
|
|
properties: 'layer' = 1/2/3 (INT)
|
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
3 - Ogg/Vorbis
|
2003-06-06 23:49:25 +00:00
|
|
|
mimetype: audio/vorbis
|
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
4 - Windows Media Audio 1 and 2 (WMA)
|
|
|
|
mimetype: audio/wma
|
2003-06-06 23:49:25 +00:00
|
|
|
properties: 'wmaversion' = 1/2 (INT)
|
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
5 - AC3
|
2003-06-20 16:33:54 +00:00
|
|
|
mimetype: audio/a52
|
2003-01-07 21:00:00 +00:00
|
|
|
|
2003-06-06 23:49:25 +00:00
|
|
|
6 - FLAC (Free Lossless Audio Codec)
|
|
|
|
mimetype: audio/x-flac
|
|
|
|
|
2003-06-20 16:39:21 +00:00
|
|
|
7 - MACE 3/6 (Quicktime audio)
|
|
|
|
mimetype: audio/x-mace
|
|
|
|
properties: 'maceversion' = 3/6 (INT)
|
|
|
|
|
2003-01-07 21:00:00 +00:00
|
|
|
4 - Status of this document
|
|
|
|
---------------------------
|
2003-06-06 23:49:25 +00:00
|
|
|
Not all plugins strictly follow these guidelines yet, but these are the
|
|
|
|
official types. Plugins not following these specs either use extensions
|
|
|
|
that should be documented, or are buggy (and should be fixed).
|
2003-01-07 21:00:00 +00:00
|
|
|
|
|
|
|
Blame Ronald Bultje <rbultje@ronald.bitfreak.net> aka BBB for any mistakes
|
|
|
|
in this document.
|