Configuring the ASF Writer
[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
When the WM ASF Writer filter is created, it is configured automatically with the WMProfile_V80_256Video profile. This profile uses the Windows Media Audio and Windows Media Video version 8 codecs, which are not as recent as the Windows Media 9 Series codecs. It is recommended to create a custom profile that uses the Windows Media 9 Series codecs, and configure the WM ASF Writer with the custom profile, as described in Configuring Profiles and Other ASF File Properties. You must add the WM ASF Writer filter to the filter graph before configuring the filter, and configure the filter before connecting it to any other filters.
All input data must be time-stamped, and all input pins must be connected before the filter can be run or paused. Therefore, if you configure the filter with a profile that has an audio stream and a video stream, the filter will create an audio and a video input pin, and both pins must be connected before the filter can be run. Because the Windows Media Format SDK requires an audio stream to work, the WM ASF Writer must always have an input audio pin, even if it is for a dummy stream—that is, a muted, low-bit-rate audio stream.
Adding Data Unit Extensions
You can configure a profile stream for data unit extensions, such as SMPTE time codes, either before or after the filter is connected, as long as you follow this order of operations:
- Add one or more data unit extensions to the stream using IWMStreamConfig2::AddDataUnitExtension.
- Call IWMProfile::ReconfigStream to update the profile.
- Call IConfigAsfWriter::ConfigureFilterUsingProfile with the updated profile object.
- Find the video input pin, and call its IAMWMBufferPass::SetNotify method to register your application-defined IAMWMBufferPassCallback interface.
When the graph runs, your IAMWMBufferPassCallback::Notify method will be called for each frame, and you will be able to get and set properties on the sample using its INSSBuffer3 interface methods.
Note
In some processor-intensive scenarios such as inverse telecine, the WM ASF Writer may require more output buffers than some downstream filters can support. The DV Decoder, for example, will not accept more than one buffer for its output pin and the same is true for the AVI Decompressor in certain conditions. If you encounter problems when attempting to connect to these filters, or possibly when running the graph, it may be necessary to write an intermediary filter that accepts any number of buffers on its output pin.
Related topics