[an error occurred while processing this directive]
Today's Windows' multimedia architecture is based on DirectShow, which works basically as a collections of filters with input(s) and/or output(s) for data. Every multimedia component is represented by a DirectShow filter. This includes audio/video compressors/de-compressors, but also the input/output of your soundcard, along with many others. By connecting filters together, you create data paths for multimedia data, eventually resulting in an action (for example a video compression conversion).
Microsoft's DirectShow SDK (Software Development Kit) comes with a great application called Graph Edit, which allows you to graphically build filter graphs, thus manipulate directly every multimedia component of your system!
When you open GraphEdit, you find yourself in front of an empty workspace.
You should start by adding the filters you wish to use, using the Graph ->
Insert Filters menu.
![]() |
This opens a filter-selection dialog, where you can choose filters from. Filters are separated into many categories.
![]() |
The following tables describes the most commonly used categories :
|
When expand one category and double-click on a filter, it creates a box in the workspace, which represents the selected filter.
To create a data path, you have to interconnect filters. This is done by
linking an output pin to an input pin with the mouse. Note that you can only
interconnect pins of the same type (you will get an error message otherwise).
Sometime, GraphEdit will automatically add intermediate filters when you try to
connect pins of incompatible types. That is, it will search for possible
intermediate filters that will make the pins compatible. If you do not want this
behaviour, you can de-activate it in the Graph -> Connect Intelligent
menu.
Filter can be delete by selecting them (normal single-click) and pressing the delete key. Some filters/pins have properties that can be modified. This can be done by right-clicking on the filer/pin and choosing 'properties'.
Also, part of the graph can be generated automatically downstream, by right-clicking an output pin and choosing 'render'. This will place all necessary filters to completely render the pin according to default behaviour (which is usually "playback"). When the graph is done, it can be run by pressing the "play" button in the application's button bar.
In this example, we will crate a filtergraph to make an AVI conversion.
First, we decide what exactly we want the graph to do:
- Import an MPEG-1 audio/video stream
- Convert the video to Divx format
- Multiplex Divx video and unaltered MPG audio into AVI and save to disk
- Decode MPG audio and save to disk as PCM wave
- Monitor video-only progress
Start by placing a DirectShow Filters -> File Source (Async.)
and select the input MPEG file (Loto-quebec MPEG.mpg). Parse the stream using a
DirectShow Filters -> MPEG-I Stream Splitter.
Then place a DirectShow Filters -> MPEG Video Decoder in the video
data path.
![]() |
Next, bring two DirectShow Filters -> Infinite Pin Tee Filter.
Connect one of them with the audio output of the stream splitter and the other
with the output of the video decoder. These are used to duplicate the data.
Place also a Video Compressors -> Divx ;-) MPEG-4 Low-Motion in the
video data path.
Then, use a DirectShow Filters -> AVI Mux to connect the Divx
output and MPG audio data. Connect the AVI Mux's output to a DirectShow
Filters -> File Writer. Provide with a filename when prompted to (Loto-quebec
DivX.avi).
To decode the MPG audio and save it to disk, start by connecting the output 2
of the audio path's tee filter to a DirectShow Filters -> MPEG Audio
Decoder. Finish the path with a DirectShow -> WAV Dest
followed by a DirectShow Filters -> File Writer. Enter the wave
file's name when prompted (loto-quebec Audio.wav).
Note: If you do not have the "WAV Dest" filter, you can find it in the download section.
Finally, to monitor the video-only progress (watch video in real-time as it
gets converted), connect the video path's tee filter to a DirectShow ->
Video Renderer.
Now that the graph is completed, all you have to do is to press the PLAY button to start the process.
You can download the sample materials:
|
|
|
|
||||
| Loto-quebec MPEG | Loto-quebec Audio | Loto-quebec DivX |
This example should have given you an good idea of all what you can do with GraphEdit. Possibilities are only limited by your imagination … It filtergraphs interest you, I encourage you to "play around" with them to familiarise yourself.
It is also possible to add new filters to your existing filter collection.
Filters are files with AX extension (sometimes DLL extension).
To "register" a new filter, you must use a command-line utility called
RegSvr32, that you can find in your windows\system directory (\\Windows\system
under Windows 98 or \\WINNT\system32 under Windows NT/ 2000).
This table provides a descriptions for DirectShow for which the title is not fully self-explanatory.
|
We have added an extra example to show how to downmix Dolby Digital AC-3 to
Dolby Surround. This is done simply with the iviaudio.ax (Intervideo
filter provided with WinDVD).
The filtering is as simple as Open the AC-3 file and Parse, then
Downmix with InterVideo Audio Decoder for a WAV format and Save it:
Configure the InterVideo filter for downmixing:
![]() |