DirectShow Media Types (Compact 2013)
3/26/2014
DirectShow uses the AM_MEDIA_TYPE structure to describe media samples.
This structure includes GUID fields for major type, subtype, and format type, in addition to fields specifying other properties of the sample, such as sample compression.
The major type and subtype options registered by DirectShow are described below. These media types are defined in the header file Uuids.h.
Media Types with No Subtype
The following table describes the media types that have no subtype.
Type |
Description |
---|---|
MEDIATYPE_AnalogAudio |
Analog audio connection. |
MEDIATYPE_File |
Media type is a file, used by closed captioning. |
MEDIATYPE_Interleaved |
Data is interleaved, used by Digital Video (DV). |
MEDIATYPE_ScriptCommand |
Data is a script command, used by closed captioning. |
MEDIATYPE_Text |
Data is text. |
MEDIATYPE_Timecode |
Data is timecode data. |
Audio Media Types
The wFormatTag member in the WAVEFORMATEX structure specifies the audio format type.
The format type is generally FORMAT_WaveFormatEx. Media samples are generally a whole number of samples as specified in the wBitsPerSample member in the WAVEFORMATEX structure. This format does not always apply to MPEG audio samples that can come from packetized streams; therefore, those samples may not be packaged on sample/frame boundaries.
For MPEG audio, the timestamp in a media sample is the timestamp for the first frame whose first byte is contained in the media sample.
Media subtypes are defined for each wFormatTag as follows:
- The Data1 subfield of the Media Subtype is the same as the wFormatTag value.
- The Data 2 field is 0.
- The Data 3 field is 0x0010.
- The Data 4 field is 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71.
Thus, for pulse-code modulation (PCM) audio the subtype GUID would be:
{00000001-0000-0010-8000-00AA00389B71}
Older filters may still use GUID_NULL as the subtype, so you must update the subtype. However, registration of a filter with the explicit subtype greatly improves the speed of graph loading, especially when the given filter is not required.
You can use the CreateAudioMediaType function to create an AM_MEDIA_TYPE structure from a WAVEFORMATEX (Waveform Audio) structure.
The following table describes the audio media subtypes.
MEDIATYPE_Audio |
Data is audio |
---|---|
MEDIASUBTYPE_PCMAudio |
PCM audio |
MEDIASUBTYPE_MPEG1Packet |
MPEG-1 Audio Packet |
MEDIASUBTYPE_MPEG1Payload |
MPEG-1 Audio Payload |
MEDIASUBTYPE_DOLBY_AC3 |
Dolby AC3 data |
MEDIASUBTYPE_MPEG2_AUDIO |
MPEG-2 audio data |
MEDIASUBTYPE_DVD_LPCM_AUDIO |
DVD audio data |
MEDIASUBTYPE_MPEG_ADTS_AAC |
AAC in an Audio Data Transport Stream (ADTS) for streaming. |
Line 21 Media Types
The following table describes the line 21 closed captioning media subtypes.
MEDIATYPE_AUXLine21Data |
Data is line 21 type, used by closed captioning |
---|---|
MEDIASUBTYPE_Line21_BytePair |
Line 21 data as byte pairs |
MEDIASUBTYPE_Line21_GOPPacket |
Line 21 data in DVD group of pictures (GOP) packet |
MEDIASUBTYPE_Line21_VBIRawData |
Line 21 data in raw Vertical Blank Interleave (VBI) format |
Stream Media Types
Timestamps are byte positions * 10000000 (notionally 1 byte per second) rather than real times.
The following table describes the stream media subtypes.
MEDIATYPE_Stream |
Data is a non-timestamped byte stream |
---|---|
MEDIASUBTYPE_Avi |
Data from AVI file |
MEDIASUBTYPE_WAVE |
Data from WAV file |
MEDIASUBTYPE_AU |
Data from AU file |
MEDIASUBTYPE_AIFF |
Data from AIFF file |
MEDIASUBTYPE_PCM |
Data from PCM files |
MEDIASUBTYPE_MPEG1Video |
MPEG video |
MEDIASUBTYPE_MPEG1System |
MPEG system |
MEDIASUBTYPE_MPEG1VideoCD |
MPEG video CD |
MEDIASUBTYPE_MPEG1Audio |
MPEG audio |
MEDIASUBTYPE_DssVideo |
Dss video |
MEDIASUBTYPE_DssAudio |
Dss audio |
Video Media Types
The following table describes the video media subtypes.
MEDIATYPE_Video |
Data is video |
---|---|
MEDIASUBTYPE_YVU9 |
Standard YVU9 format uncompressed data. A planar YUV format. A Y sample at every pixel, a U and V sample at every fourth pixel horizontally on each line; a Y sample on every vertical line, a U and V sample at every fourth vertical line. 9 bits per pixel. |
MEDIASUBTYPE_Y411 |
YUV 411 format data. Same as Y41P. |
MEDIASUBTYPE_Y41P |
Y41P format data. A packed YUV format. A Y sample at every pixel, a U and V sample at every fourth pixel horizontally on each line; every vertical line sampled. Byte ordering (lowest first) is U0, Y0, V0, Y1, U4, Y2, V4, Y3, Y4, Y5, Y6, Y7, where the suffix 0 is the leftmost pixel and increasing numbers are pixels increasing left to right. Each 12-byte block is 8 image pixels. |
MEDIASUBTYPE_YUY2 |
YUY2 format data. Same as UYVY but with different pixel ordering. Byte ordering (lowest first) is Y0, U0, Y1, V0, Y2, U2, Y3, V2, Y4, U4, Y5, V4, where the suffix 0 is the leftmost pixel and increasing numbers are pixels increasing left to right. Each 4-byte block is 2 image pixels. |
MEDIASUBTYPE_YVYU |
YVYU format data. A packed YUV format. Same as UYVY but with different pixel ordering. Byte ordering (lowest first) is Y0, V0, Y1, U0, Y2, V2, Y3, U2, Y4, V4, Y5, U4, where the suffix 0 is the leftmost pixel and increasing numbers are pixels increasing left to right. Each 4-byte block is 2 image pixels. |
MEDIASUBTYPE_UYVY |
UYVY format data. A packed YUV format. A Y sample at every pixel, a U and V sample at every second pixel horizontally on each line; every vertical line sampled. Most popular of the various YUV 4:2:2 formats. Byte ordering (lowest first) is U0, Y0, V0, Y1, U2, Y2, V2, Y3, U4, Y4, V4, Y5, where the suffix 0 is the leftmost pixel and increasing numbers are pixels increasing left to right. Each 4-byte block is 2 image pixels. |
MEDIASUBTYPE_Y211 |
YUV 211 format data. A packed YUV format. A Y sample at every second pixel, a U and V sample at every fourth pixel horizontally on each line; every vertical line sampled. Byte ordering (lowest first) is Y0, U0, Y2, V0, Y4, U4, Y6, V4, Y8, U8, Y10, V8, where the suffix 0 is the leftmost pixel and increasing numbers are pixels increasing left to right. Each 4-byte block is 4 image pixels. |
MEDIASUBTYPE_CLJR |
Cirrus Logic Jr YUV 411 format with less than 8 bits per Y, U, and V sample. A Y sample at every pixel, a U and V sample at every fourth pixel horizontally on each line; every vertical line sampled. |
MEDIASUBTYPE_IF09 |
Indeo-produced YVU9 format with additional information about differences from the last frame. 9.5 bits per pixel but reported as 9. |
MEDIASUBTYPE_MJPG |
Motion JPEG (MJPG) compressed video. |
MEDIASUBTYPE_TVMJ |
TrueVision MJPG format. |
MEDIASUBTYPE_WAKE |
MJPG format produced by certain video cards. |
MEDIASUBTYPE_CFCC |
MJPG format produced by certain video cards. |
MEDIASUBTYPE_IJPG |
JPEG format. |
MEDIASUBTYPE_Plum |
Plum MJPG format. |
MEDIASUBTYPE_RGB1 |
RGB 1 bit per pixel. Palettized. |
MEDIASUBTYPE_RGB4 |
RGB 4 bits per pixel. Palettized. |
MEDIASUBTYPE_RGB8 |
RGB 8 bits per pixel. Palettized. |
MEDIASUBTYPE_RGB565 |
565 format of RGB, 16 bits per pixel. Uncompressed RGB samples. |
MEDIASUBTYPE_RGB555 |
555 format of RGB, 16 bits per pixel. Uncompressed RGB samples. |
MEDIASUBTYPE_RGB24 |
RGB 24 bits per pixel. Uncompressed RGB samples. |
MEDIASUBTYPE_RGB32 |
RGB 32 bits per pixel. Uncompressed RGB samples. |
MEDIASUBTYPE_Overlay |
Video delivered by using hardware overlay. |
MEDIASUBTYPE_dvsd |
Standard DV format. |
MEDIASUBTYPE_dvhd |
High Definition DV format. |
MEDIASUBTYPE_dvsl |
Long Play DV format. |
MEDIASUBTYPE_MPEG1Packet |
MPEG1 Video Packet. |
MEDIASUBTYPE_MPEG1Payload |
MPEG1 Video Payload. |
MEDIASUBTYPE_VideoPort |
Data is video port data, used with DVD. |
MEDIASUBTYPE_h264 |
H.264 bit stream with start codes. |
MEDIASUBTYPE_MP4V |
Input media type supported by the MPEG4 Part 2 Video. |