6581 Useful Things

October 12, 2006

Instantiating Directshow filters by name

Filed under: DirectShow — sid6581 @ 9:43 pm

One of the most basic things you need to do in a DirectShow application is add filters to a graph. If it is a basic stock filter you can usually find the CLSID in MSDN, and creating the filter is as easy instantiating it as a regular COM object from that CLSID.

If you fire up GraphEdit on your system you’ll probably find a whole bunch of different filters that aren’t mentioned in MSDN. For instance, in the video compressor category there are several interesting filters:


October 9, 2006

Minimizing audio capture latency in DirectShow

Filed under: DirectShow — sid6581 @ 8:21 pm

If you have used DirectShow for audio capture, you have probably noticed that audio that is being previewed by an audio renderer in your graph can significantly lag the audio capture source. This is especially obvious if you are capturing and previewing both audio and video, where this lag will make your preview look like a badly dubbed movie.

The cause of the lag can be hard to track down if you don’t know where to look. It turns out that the reason is that the audio capture source in DirectShow defaults to using 500ms buffers. In other words, the capture source has to capture 500ms worth of audio before it can pass the buffer downstream. Since the audio renderer can’t render any audio until it gets the buffer from the source, there will be at least a 500ms latency between any audio being captured and any audio being played.

Create a free website or blog at WordPress.com.