Frequently Asked Questions About the DirectShow and Windows Media SDKs

Microsoft Corporation

December 2001

Summary: This document provides answers to frequently asked questions about the Microsoft DirectShow and Microsoft Windows Media software development kits (SDKs). (6 printed pages)

Why use Microsoft® Windows Media™?

Microsoft provides several SDKs for Windows Media, collectively referred to as the Windows Media SDK. At the core is a container format and codecs that support powerful content generation, distribution, and client playback. Content can be distributed by network streaming, downloading, and progressive downloading. The Advanced Streaming Format (ASF) container and Windows Media codecs are optimized for market-leading quality and features with low bandwidth and storage requirements.

What are the component SDKs in the Windows Media SDK?
  • Core I/OWindows Media Format SDK
    Provides application programming interfaces (APIs) for reading and writing ASF content and distributing Windows Media audio, video, and screen codecs, plus the Sipro Labs ACELP voice codec and ISO MPEG-4 video codec version 1.0. Each of the SDKs listed below depend on this technology.
  • Generation and distributionWindows Media Encoder SDK
    Exposes automation for Windows Media Encoder application objects, allowing live capture to ASF files or network streams.
  • DistributionWindows Media Services SDK
    Provides programmatic control over unicast, multicast, and broadcast Windows Media streams.
  • PlaybackWindows Media Player SDK
    Enables customization of skins and visualizations, and distributes an embeddable Microsoft ActiveX® control version of the Player.

Each of these SDKs provides APIs tailored for specific tasks in handling Windows Media. Windows Media Technologies is the collective name for these SDKs and all Microsoft applications built upon them.

What is Microsoft DirectShow®?

DirectShow is a generic framework developed primarily for client-side streaming. Pluggable COM objects called filters are connected within a data-flow topology called a filter graph to implement streaming solutions. Microsoft provides a large number of filters to support many application areas. Developers can also create custom filters. DirectShow became an integral part of Microsoft DirectX® starting with version 8.0.

What are the key concepts in DirectShow?

DirectShow is:

  • Modular—filters are truly reusable.
  • Autonomous—filters have embedded threads that transfer and operate on data. Buffering is also automatic, requiring no application code.
  • Asynchronous—the filter graph manager sequences the states of filters. Applications primarily control the overall streaming state of the autonomous filter graph by using the filter graph manager.
  • Efficient—the use of techniques such as shared memory buffers minimizes overhead common to generic architectures. For example, DirectShow supports high-definition television (HDTV) reception and rendering.

Filters are classified as sources (they provide data into a graph), transforms (they operate on input data to create output), or renderers (they output data to a device). All filters operate in user mode.

How does data enter and leave the filter graph?

DirectShow provides:

  • Source filters that leverage the kernel Windows Driver Model (WDM) streaming model (and legacy Video for Windows (VfW) devices with limitations) to support Webcams, digital video cameras, analog and digital TV tuners, DVDs, and sound cards, as well as files.
  • Renderer filters capable of video display using Microsoft DirectDraw®, audio output using Microsoft DirectSound® or WaveOut, and file output.

Integration of non-DirectShow code with DirectShow requires the conversion of all streaming functionality to filters, or the development of custom filters to inject or extract streams from the filter graph. Please see the DirectShow Ball sample for an example of injection, and the GrabberSample filter sample for help in extraction. DirectX 8.1 ships the source code for GrabberSample.

How is DirectShow related to Windows Media Technologies?
  • DirectShow requires the Windows Media Format SDK to read and write ASF. It wraps the Format SDK objects into filters, exposing APIs that are consistent with DirectShow filter graphs.
  • Windows Media Player uses DirectShow for all non-Windows Media playback.
  • Windows Media Encoder uses DirectShow for capture.
What are the key tradeoffs in selecting Windows Media component SDKs or DirectShow for application development?
  • DirectShow supports manipulation of many formats (MPEG-1, MPEG-2, MP3 audio, WAV, AVI) in addition to Windows Media, whereas Windows Media (WM) SDKs persist all content as Windows Media.
  • DirectShow provides generic sourcing and rendering support, whereas the Windows Media Encoder SDK and Windows Media Player SDK ActiveX control are tailored capture and playback solutions. It is often easier to deploy the encoder and player APIs than to learn the DirectShow APIs.
  • Network streaming is best done using Windows Media SDKs. Windows Media gives the highest quality for a given bandwidth, and the Windows Media Format SDK exposes more powerful APIs than DirectShow for controlling streaming. Windows Media Encoder SDK plus the Player ActiveX control (and optionally Windows Media Services) provide turnkey solutions, versus custom solutions using DirectShow.

Note that use of DirectShow or Windows Media SDKs is not necessarily an "either-or" decision.

What are the options for writing Windows Media?
  • Windows Media Encoder SDK—provides automation objects plus an optional user interface for live capture, and supports direct network streaming with up to 50 unicast outputs.
  • Windows Media Format SDK—core APIs take filled audio and video sample buffers and a profile, and create either files or sources for streaming over a network.
  • DirectShow—a filter graph built with the ASF Writer filter creates either files or a source for streaming over a network.
What are the options for reading Windows Media?
  • Windows Media Player SDK—the ActiveX control can be embedded within an application. It can also provide powerful playback support.
  • Windows Media Format SDK—core APIs fill audio and video sample buffers for application use.
  • DirectShow—a filter graph built with the ASF Reader filter creates either files or sources for streaming over a network.
How do I obtain and use the Windows Media Format SDK?

For information about downloading and using the Windows Media Format SDK, see Windows Media SDK Components.

Am I using the correct ASF Reader filter?

If you do not have the Windows Media 9 Series runtime, DirectShow uses an older Windows Media Source filter, for compatibility with Windows Media Player 6.4. To use the newer ASF Reader filter, you must add it to the graph manually.

 If you do have the Windows Media 9 Series runtime, DirectShow defaults to the newer ASF Reader filter. Of course, you can still manually add it to the graph manually.

Why am I experiencing poor seeking performance with the ASF Reader?

You may be inadvertently using the older ASF Reader. See the answer to the previous question.

How do I use digital rights management (DRM) with DirectShow?

Due to an incompatibility between the Windows Media Format SDK and DirectShow, DRM does not function in DirectX releases earlier than version 8.1. DirectX 8.1 is intrinsic to Windows XP, and is available as separate runtimes for other platforms. To use DRM, you must get a DRM-enabled stub library from Microsoft and use it in place of wmstub.lib. For more information about DRM components and licensing, see the Windows Media Licensing page.

How do I license and redistribute DirectShow?

See Microsoft DirectShow Licensing.