Media Foundation (MF) is a
COM-based multimedia framework
A multimedia framework is a software framework that handles Electronic media, media on a computer and through a network. A good multimedia framework offers an intuitive Application programming interface, API and a modular architecture to easily a ...
pipeline and infrastructure platform for digital media in
Windows Vista
Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, released five years earlier, which was then the longest time span between successive releases of Microsoft W ...
,
Windows 7
Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was Software release life cycle#Release to manufacturing (RTM), released to manufacturing on July 22, 2009, and became generally available on October 22, ...
,
Windows 8
Windows 8 is a major release of the Windows NT operating system developed by Microsoft. It was Software release life cycle#Release to manufacturing (RTM), released to manufacturing on August 1, 2012, made available for download via Microsoft ...
,
Windows 8.1,
Windows 10
Windows 10 is a major release of Microsoft's Windows NT operating system. The successor to Windows 8.1, it was Software release cycle#Release to manufacturing (RTM), released to manufacturing on July 15, 2015, and later to retail on July 2 ...
, and
Windows 11
Windows 11 is a version of Microsoft's Windows NT operating system, released on October 5, 2021, as the successor to Windows 10 (2015). It is available as a free upgrade for devices running Windows 10 that meet the #System requirements, Windo ...
. It is the intended replacement for Microsoft
DirectShow
DirectShow (sometimes abbreviated as DS or DShow), codename Quartz, is a multimedia framework and API produced by Microsoft for software developers to perform various operations with media files or streams. It is the replacement for Microsoft's ea ...
,
Windows Media SDK,
DirectX Media Objects (DMOs) and all other so-called "legacy" multimedia APIs such as
Audio Compression Manager (ACM) and
Video for Windows (VfW). The existing
DirectShow
DirectShow (sometimes abbreviated as DS or DShow), codename Quartz, is a multimedia framework and API produced by Microsoft for software developers to perform various operations with media files or streams. It is the replacement for Microsoft's ea ...
technology is intended to be replaced by Media Foundation step-by-step, starting with a few features. For some time there will be a co-existence of Media Foundation and DirectShow. Media Foundation will not be available for previous Windows versions, including
Windows XP
Windows XP is a major release of Microsoft's Windows NT operating system. It was released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct successor to Windows 2000 for high-end and business users a ...
.
The first release, present in
Windows Vista
Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, released five years earlier, which was then the longest time span between successive releases of Microsoft W ...
, focuses on audio and video playback quality,
high-definition content (i.e.
HDTV
High-definition television (HDTV) describes a television or video system which provides a substantially higher image resolution than the previous generation of technologies. The term has been used since at least 1933; in more recent times, it ref ...
), content protection and a more unified approach for digital data access control for
digital rights management
Digital rights management (DRM) is the management of legal access to digital content. Various tools or technological protection measures, such as access control technologies, can restrict the use of proprietary hardware and copyrighted works. DRM ...
(DRM) and its interoperability. It integrates
DXVA 2.0 for offloading more of the video processing pipeline to hardware, for better performance. Videos are processed in the colorspace they were encoded in, and are handed off to the hardware, which composes the image in its native colorspace. This prevents intermediate colorspace conversions to improve performance. MF includes a new video renderer, called ''Enhanced Video Renderer'' (EVR), which is the next iteration of
VMR 7 and 9. EVR has better support for playback timing and synchronization. It uses the
Multimedia Class Scheduler Service
Multimedia Class Scheduler Service (MMCSS) is a Windows service that allows multimedia applications to get prioritized access to CPU for time-sensitive processing (such as multimedia applications) as well as prioritized disc access to ensure that t ...
(MMCSS), a new
service
Service may refer to:
Activities
* Administrative service, a required part of the workload of university faculty
* Civil service, the body of employees of a government
* Community service, volunteer service for the benefit of a community or a ...
that prioritizes real time multimedia processing, to reserve the resources required for the playback, without any tearing or glitches.
The second release included in
Windows 7
Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was Software release life cycle#Release to manufacturing (RTM), released to manufacturing on July 22, 2009, and became generally available on October 22, ...
introduces expanded media format support and
DXVA HD for acceleration of HD content if
WDDM 1.1 drivers are used.
Architecture
The MF architecture is divided into the ''Control layer'', ''Core Layer'' and the ''Platform layer''. The core layer encapsulates most of the functionality of Media Foundation. It consists of the media foundation pipeline, which has three components: ''Media Source'', ''Media Sink'' and ''Media Foundation Transforms'' (MFT). A media source is an object that acts as the source of multimedia data, either compressed or uncompressed. It can encapsulate various data sources, like a file, or a network server or even a camcorder, with source specific functionality
abstracted by a common
interface. A source object can use a ''source resolver'' object which creates a media source from an
URI
Uri may refer to:
Places
* Canton of Uri, a canton in Switzerland
* Úri, a village and commune in Hungary
* Uri, Iran, a village in East Azerbaijan Province
* Uri, Jammu and Kashmir, a town in India
* Uri (island), off Malakula Island in V ...
, file or bytestream. Support for non-standard protocols can be added by creating a source resolver for them. A source object can also use a ''sequencer'' object to use a sequence of sources (a
playlist
A playlist is a list of video or audio files that can be played back on a media player, either sequentially or in a shuffled order. In its most general form, an audio playlist is simply a list of songs that can be played once or in a loop. ...
) or to coalesce multiple sources into single logical source. A media sink is the recipient of processed multimedia data. A media sink can either be a ''renderer sink'', which renders the content on an output device, or an ''archive sink'', which saves the content onto a persistent storage system such as a file. A renderer sink takes uncompressed data as input whereas an archive sink can take either compressed or uncompressed data, depending on the output type. The data from media sources to sinks are acted upon by MFTs; MFTs are certain functions which transform the data into another form. MFTs can include multiplexers and demultiplexers, codecs or
DSP effects like
reverb
In acoustics, reverberation (commonly shortened to reverb) is a persistence of sound after it is produced. It is often created when a sound is reflected on surfaces, causing multiple reflections that build up and then decay as the sound is a ...
. The ''core layer'' uses services like file access and networking and clock synchronization to time the multimedia rendering. These are part of the ''Platform layer'', which provides services necessary for accessing the source and sink byte streams, presentation clocks and an object model that lets the core layer components function asynchronously, and is generally implemented as OS services. Pausing, stopping, fast forward, reverse or
time-compression can be achieved by controlling the presentation clock.
However, the media pipeline components are not connected; rather they are just presented as discrete components. An application running in the ''Control layer'' has to choose which source types, transforms and sinks are needed for the particular video processing task at hand, and set up the "connections" between the components (a ''topology'') to complete the data flow pipeline. For example, to play back a compressed audio/video file, the pipeline will consist of a file source object, a demultiplexer for the specific file container format to split the audio and video streams, codecs to decompress the audio and video streams, DSP processors for audio and video effects and finally the EVR renderer, in sequence. Or for a video capture application, the camcorder will act as video and audio sources, on which codec MFTs will work to compress the data and feed to a multiplexer that coalesces the streams into a container; and finally a file sink or a network sink will write it to a file or
stream
A stream is a continuous body of water, body of surface water Current (stream), flowing within the stream bed, bed and bank (geography), banks of a channel (geography), channel. Depending on its location or certain characteristics, a strea ...
over a network. The application also has to co-ordinate the flow of data between the pipeline components. The control layer has to "pull" (request) samples from one pipeline component and pass it onto the next component in order to achieve data flow within the pipeline. This is in contrast to
DirectShow's "push" model where a pipeline component pushes data to the next component. Media Foundation allows content protection by hosting the pipeline within a protected execution environment, called the
Protected Media Path
The Protected Media Path is a set of technologies creating a "Protected Environment," first included in Microsoft's Windows Vista operating system, that is used to enforce digital rights management (DRM) protections on content.
Its subsets are ''P ...
. The control layer components are required to propagate the data through the pipeline at a rate that the rendering synchronizes with the presentation clock. The rate (or time) of rendering is embedded as a part of the multimedia stream as metadata. The source objects extract the metadata and pass it over. Metadata is of two types: ''coded metadata'', which is information about bit rate and presentation timings, and ''descriptive metadata'', like title and author names. Coded metadata is handed over to the object that controls the pipeline session, and descriptive metadata is exposed for the application to use if it chooses to.
Media Foundation provides a ''Media Session'' object that can be used to set up the topologies, and facilitate a data flow, without the application doing it explicitly. It exists in the control layer, and exposes a ''Topology loader'' object. The application specifies the required pipeline topology to the loader, which then creates the necessary connections between the components. The media session object manages the job of synchronizing with the presentation clock. It creates the presentation clock object, and passes a reference to it to the sink. It then uses the timer events from the clock to propagate data along the pipeline. It also changes the state of the clock to handle pause, stop or resume requests from the application.
Practical MF Architectures
Theoretically there is only one Media Foundation architecture and this is the Media Session, Pipeline, Media Source, Transform and Media Sink model. However this architecture can be complex to set up and there is considerable scope for lightweight, relatively easy to configure MF components designed to handle the processing of media data for simple point solutions. Thus practical considerations necessitated the implementation of variations on the fundamental Pipeline design and components such as the Source Reader and Sink Writer which operate outside the Pipeline model were developed. Some sources split the Media Foundation architecture into three general classes.
* The Pipeline Architecture
* The Reader-Writer Architecture
* Hybrids between the Pipeline and Reader-Writer Architectures
The Pipeline Architecture is distinguished by the use of a distinct Media Session object and Pipeline. The media data flows from one or more Media Sources to one or more Media Sinks and, optionally, through zero or more Media Transforms. It is the Media Session that manages the flow of the media data through the Pipeline and that Pipeline can have multiple forks and branches. An MF application can get access to the media data as it traverses from a Media Source to a Media Sink by implementing a custom Media Transform component and inserting it in an appropriate location in the Pipeline.
The Reader-Writer Architecture uses a component called a Source Reader to provide the media data and a Sink Writer component to consume it. The Source Reader does contain a type of internal pipeline but this is not accessible to the application. A Source Reader is not a Media Source and a Sink Writer is not a Media Sink and neither can be directly included in a Pipeline or managed by a Media Session. In general, the media data flows from the Source Reader to the Sink Writer by the actions of the application. The application will either take the packets of media data (called Media Samples) from the Source Reader and give them directly them to the Sink Writer or it will set up a callback function on the Source Reader which performs the same operation. In effect, as it manages the data transport, the application itself performs a similar role to that of the Media Session in a Pipeline Architecture application. Since the MF application manages the transmission of the Media Samples between the Source Reader and Sink Writer it will always have access to the raw media data. The Source Reader and Sink Writer components do have a limited ability to automatically load Media Transforms to assist with the conversion of the format of the media data, however, this is done internally and the application has little control over it.
The Source Reader and Sink Writer provide ease of use and the Pipeline Architecture offers extremely sophisticated control over the flow of the media data. However, many of the components available to a Pipeline (such as the Enhanced Video Renderer) are simply not readily usable in a Reader-Writer architecture application. Since the structure of a Media Sample produced by a Source Reader is identical to that output by a Media Source it is possible to set up a Pipeline Architecture in which the Media Samples are intercepted as they pass through the Pipeline and a copy is given to a Media Sink. This is known as a Hybrid Architecture and it makes it possible to have an application which takes advantage of the sophisticated processing abilities of the Media Session and Pipeline while utilizing the ease of use of a Sink Writer. The Sink Writer is not part of the Pipeline and it does not interact with the Media Session. In effect, the media data is processed by a special Media Sink called a Sample Grabber Sink which consumes the media data and hands a copy off to the Sink Writer as it does so. It is also possible to implement a Hybrid Architecture with a custom Media Transform which copies the Media Samples and passes them to a Sink Writer as they pass through the Pipeline. In both cases a special component in the Pipeline effectively acts like a simple Reader-Writer application and feeds a Sink Writer. In general, Hybrid Architectures use a Pipeline and a Sink Writer. Theoretically, it is possible to implement a mechanism in which a Source Reader could somehow inject Media Samples into a Pipeline but, unlike the Sample Grabber Sink, no such standard component exists.
Media Foundation Transform
Media Foundation Transforms (MFTs) represent a generic model for processing media data. They are used in Media Foundation primarily to implement decoders, encoders, mixers and digital signal processors (DSPs) – between ''media sources'' and ''media sinks''. Media Foundation Transforms are an evolution of the transform model first introduced with
DirectX Media Objects (DMOs). Their behaviors are more clearly specified. Hybrid DMO/MFT Objects can also be created. Applications can use MFTs inside the Media Foundation pipeline, or use them directly as stand-alone objects. MFTs can be any of the following type:
* Audio and video codecs
* Audio and video effects
* Multiplexers and demultiplexers
* Tees
* Color-space converters
* Sample-rate converters
* Video scalers
Microsoft recommends developers to write a ''Media Foundation Transform'' instead of a DirectShow filter, for
Windows Vista
Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, released five years earlier, which was then the longest time span between successive releases of Microsoft W ...
,
Windows 7
Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was Software release life cycle#Release to manufacturing (RTM), released to manufacturing on July 22, 2009, and became generally available on October 22, ...
&
Windows 8
Windows 8 is a major release of the Windows NT operating system developed by Microsoft. It was Software release life cycle#Release to manufacturing (RTM), released to manufacturing on August 1, 2012, made available for download via Microsoft ...
. For video editing and video capture, Microsoft recommends using DirectShow as they are not the primary focus of Media Foundation in Windows Vista. Starting with Windows 7, MFTs also support hardware-accelerated video processing, encoding and decoding for AVStream-based media devices.
Enhanced Video Renderer
Media Foundation uses the Enhanced Video Renderer (EVR) for rendering video content, which acts as a mixer as well. It can mix up to 16 simultaneous streams, with the first stream being a ''reference stream''. All but the reference stream can have per-pixel
transparency information, as well as any specified
z-order. The reference stream cannot have transparent pixels, and has a fixed z-order position, at the back of all streams. The final image is composited onto a single surface by coloring each pixel according to the color and transparency of the corresponding pixel in all streams.
Internally, the EVR uses a ''mixer'' object for mixing the streams. It can also deinterlace the output and apply color correction, if required. The composited frame is handed off to a ''presenter'' object, which schedules them for rendering onto a Direct3D device, which it shares with the
DWM and other applications using the device. The frame rate of the output video is synchronized with the frame rate of the reference stream. If any of the other streams (called ''substreams'') have a different frame rate, EVR discards the extra frames (if the substream has a higher frame rate), or uses the same frame more than once (if it has a lower frame rate).
Supported media formats
Windows Media Audio
Windows Media Audio (WMA) is a series of audio codecs and their corresponding audio coding formats developed by Microsoft. It is a proprietary technology that forms part of the Windows Media framework. Audio encoded in WMA is stored in a digi ...
and
Windows Media Video
Windows Media Video (WMV) is a series of video codecs and their corresponding video coding formats developed by Microsoft. It is part of the Windows Media framework. WMV consists of three distinct codecs: the original video compression technolog ...
are the only default supported formats for encoding through Media Foundation in
Windows Vista
Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, released five years earlier, which was then the longest time span between successive releases of Microsoft W ...
. For decoding, an
MP3
MP3 (formally MPEG-1 Audio Layer III or MPEG-2 Audio Layer III) is a coding format for digital audio developed largely by the Fraunhofer Society in Germany under the lead of Karlheinz Brandenburg. It was designed to greatly reduce the amount ...
file source is available in Windows Vista to read MP3 streams but an MP3 file sink to output MP3 is only available in Windows 7.
Format support is extensible however; developers can add support for other formats by writing encoder/decoder MFTs and/or custom media sources/media sinks.
Windows 7 expands upon the codec support available in Windows Vista. It includes
AVI,
WAV,
AAC/ADTS file sources to read the respective formats,
an MPEG-4 file source to read
MP4, M4A, M4V, MP4V,
MOV and
3GP
3GP (3GPP file format) is a digital multimedia container format defined by the Third Generation Partnership Project (3GPP) for 3G UMTS multimedia services, largely based on MPEG-4 Part 12. A 3GP container may consist of H.263 or H.264 video ...
container formats and an MPEG-4 file sink to output to MP4 format.
Similar to Windows Vista, transcoding (encoding) support is not exposed through any built-in Windows application but several codecs are included as Media Foundation Transforms (MFTs).
In addition to
Windows Media Audio
Windows Media Audio (WMA) is a series of audio codecs and their corresponding audio coding formats developed by Microsoft. It is a proprietary technology that forms part of the Windows Media framework. Audio encoded in WMA is stored in a digi ...
and
Windows Media Video
Windows Media Video (WMV) is a series of video codecs and their corresponding video coding formats developed by Microsoft. It is part of the Windows Media framework. WMV consists of three distinct codecs: the original video compression technolog ...
encoders and decoders, and ASF file sink and file source introduced in Windows Vista,
Windows 7 includes an
H.264 encoder with Baseline profile level 3 and Main profile support and an
AAC
AAC may refer to:
Aviation
* Advanced Aircraft, a company from Carlsbad, California
* Airborne aircraft carrier, a type of aircraft
* Alaskan Air Command, a radar network
* American Aeronautical Corporation, a company from Port Washington, New ...
Low Complexity (
AAC-LC) profile encoder
For playback of various media formats, Windows 7 also introduces an H.264 decoder with Baseline, Main, and High-profile support, up to level 5.1,
AAC-LC and
HE-AAC
High-Efficiency Advanced Audio Coding (HE-AAC) is an audio coding format for lossy data compression of digital audio as part of the MPEG-4 standards. It is an extension of Low Complexity AAC (AAC-LC) optimized for low- bitrate applicati ...
v1 (
SBR) multichannel, HE-AAC v2 (
PS) stereo decoders,
MPEG-4 Part 2
MPEG-4 Part 2, MPEG-4 Visual (formally International Organization for Standardization, ISO/International Electrotechnical Commission, IEC 14496-2) is a video encoding specification designed by the Moving Picture Experts Group (MPEG). It belongs to ...
Simple Profile and
Advanced Simple Profile decoders which includes decoding popular codec implementations such as
DivX
DIVX (Digital Video Express) is a discontinued digital video format. Created in part by Circuit City, it was an unsuccessful attempt to create an alternative to video rental in the United States. The format's poor reception from consumers resu ...
,
Xvid and
Nero Digital Nero Digital is a brand name applied to a suite of MPEG-4-compatible video and audio compression codecs developed by Nero AG of Germany and Ateme of France. The audio codecs are integrated into the ''Nero Digital Audio+'' audio encoding tool for M ...
as well as
MJPEG
Motion JPEG (M-JPEG or MJPEG) is a video compression format in which each video frame or interlaced field of a digital video sequence is compressed separately as a JPEG image.
Originally developed for multimedia PC applications, Motion JPE ...
and
DV MFT decoders for AVI.
Windows Media Player 12 uses the built-in Media Foundation codecs to play these formats by default.
MIDI
Musical Instrument Digital Interface (; MIDI) is an American-Japanese technical standard that describes a communication protocol, digital interface, and electrical connectors that connect a wide variety of electronic musical instruments, ...
playback is also not yet supported using Media Foundation.
Application support
Applications that support Media Foundation include:
*
Windows Media Player
Windows Media Player (WMP, officially referred to as Windows Media Player Legacy to retronym, distinguish it from Windows Media Player (2022), the new Windows Media Player introduced with Windows 11) is the first media player (application soft ...
in Windows Vista and later
*
Windows Media Center
Windows Media Center (WMC) is a discontinued digital video recorder and media player created by Microsoft. Media Center was first introduced to Windows in 2002 on Windows XP Media Center Edition (MCE). It was included in Home Premium and U ...
in Windows Vista and later
*
Firefox
Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements curr ...
v24 and later on Windows 7 and later (only for
H.264 playback)
*
GoldWave 5.60 and later relies on Media Foundation for importing and exporting audio. For export,
AAC
AAC may refer to:
Aviation
* Advanced Aircraft, a company from Carlsbad, California
* Airborne aircraft carrier, a type of aircraft
* Alaskan Air Command, a radar network
* American Aeronautical Corporation, a company from Port Washington, New ...
and
Apple Lossless
The Apple Lossless Audio Codec (ALAC, ), also known as Apple Lossless, or Apple Lossless Encoder (ALE), is an audio coding format, and its reference audio codec implementation, developed by Apple Inc., Apple for lossless data compression of digit ...
formats can be saved via Media Foundation
Any application that uses
Protected Media Path
The Protected Media Path is a set of technologies creating a "Protected Environment," first included in Microsoft's Windows Vista operating system, that is used to enforce digital rights management (DRM) protections on content.
Its subsets are ''P ...
in Windows also uses Media Foundation.
References
External links
Microsoft Media FoundationMedia Foundation Development ForumMedia Foundation Team Blog (with samples)Media Source MetadataMedia Foundation PipelineMedia Foundation ArchitectureAbout the Media SessionEnhanced Video RendererWindows Media Foundation: Getting Started in C#
{{Microsoft APIs
Microsoft Windows multimedia technology
Microsoft application programming interfaces
Multimedia frameworks
Windows Vista