DirectShow Spy: Human Friendly Filter Graph Information and Filter Graph List

A typical task for DirectShow Spy is to get installed onto, make the target application filter graphs available for inspection and… then get inspected with some additional tool. The last step assumes there is an additional application ready to pick the graphs and an interactive user attaches to the graphs for visual inspection and troubleshooting.

There are great tools to access DirectShow filter graphs via Running Object Table, GraphEdit, GraphStudio and GraphStudioNext – to name a few. However quite so often the task in question is to simply grab information about the filter graph topology and take it away. DirectShow Spy now offers this capability:

ROT Filter Graphs

The property sheet lists the available ROT filter graphs in a developer-friendly way:

  • sorted in reverse chronological order to easily pick the one of interest
  • Check button updates filter count and state of the selected graphs
  • Copy button puts a user friendly filter graph description onto clipboard, for one or several selected filter graphs:
    • information is formatted using Markdown formatting (both readable as raw text and even better via HTML conversion; a sample filter graph information is shown below)
    • the text mentions graph state, filters, connections and media types

Clipboard integration makes it really easy to pass the information through remote access applications.

More to that, the “graph to text” conversion is available programmatically. C# code snippet (full C# project is here) as simple as the following makes Markdown filter graph information available to the application for logging or otherwise troubleshooting purposes:

[STAThread]
static void Main(string[] args)
{
    IFilterGraph2 graph = new FilterGraph() as IFilterGraph2;
    graph.RenderFile(@"E:\Media\GoPro 2010 Highlights - You in HD - 1920x1080.mp4", "");
    FilterGraphHelper helper = new FilterGraphHelper();
    helper.FilterGraph = graph;
    Console.WriteLine(helper.Text);
}

The new UI is available through exported function DoFilterGraphListPropertySheetModal.

Download links


An example of filter graph description is shown below:

Sample Markdown Output

DeckLinkCapabilities: A Printout of Capabilities of Blackmagic Design/DeckLink Hardware

The tool provides a user- (well, actually a developer-) friendly printout of capabilities accessible via Blackmagic Design DeckLink SDK for DeckLink series of hardware. This covers features of DeckLink and Intensity series of hardware for video/audio capture, accessible via vendor’s SDK. The data is printed out in Markdown format, easy to read on its own and even nicer on Markdown Pad.

Alax.Info DeckLinkCapabilities

Alax.Info DeckLinkCapabilities Output on MarkdownPad

The hardware is good, and the SDK is designed nicely as well, however the product range is wide and capabilities vary. So do driver and SDK versions, and the tool is handy to quick check the information out. One might want to use SDK for many reasons, including the following ideas I am sharing off the top of my head:

  • wanting to leverage the full feature set of the hardware
  • operate at minimal overhead
  • user a simpler API compared to generic media APIs
  • being unsatisfied with DirectShow interface provided by Blackmagic Design

Continue reading →

RotView: What is on ROT?

Once upon a time Windows SDK (or it was Visual Studio) had a tool named IROTVIEW which enumerated Running Object Table (ROT).

Running Object Table Viewer

IROTVIEW displays information about ActiveX and OLE objects currently existing in memory.

People ask “Where is IROTVIEW?” and there is no answer.

The API is really simple, but if you want a quick check what’s on your ROT you still want a handy tool. In particular, you might want to check ROT if your app is using RegisterActiveObject API to publish active COM objects. Here we go, this RotView application lists the ROT contents:

RotView UI

Available in both Win32 and x64 versions, it also shows OS marshaling of ROT entries and their availability to “both worlds”. The application does more:

  • Shows COM class descriptions for active COM objects, path to binary that hosts COM class
  • “Probes” COM objects by trying to query IUnknown of a ROT entry

Hint: Hold Ctrl+Shift to have a tool tip popping up duplicate its content onto clipboard.

Download links

CaptureClock: Utility to Check Video/Audio Capture Rates

Someone discovered the utility while browsing my public repository (the app prompts to post data back to the website, and the anonymous user accepted the offer and posted the report from this unpublished application), so I have to drop a few lines about the tool.

The idea is basically straightforward: live capture involves attaching time stamps to media samples, and there is a chance that the time stamps slide away causing unwanted effects on captured clip. The application captures video and audio simultaneously and tracks media sample time stamps, and compares them against system clock as well. Having it simply run for a few minutes one can see how the capture is doing and if any of the timings drift away. Being stopped it puts report onto clipboard and optionally posts it back to me online (no actually specific intent about this data, however if you want to share data for a device that does drift away, you are to only click once to send me the details).

CaptureClock operation

The output is on clipboard in tab-separated values (TSV) format:

Computer Name   PSI
Windows Version 6.1.7601 Service Pack 1
Video Device    Conexant's BtPCI Capture    @device:pnp:\\?\pci#ven_109e&dev_036e&subsys_18511851&rev_02#4&39c3dd91&0&08f0#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global
Audio Device    Stereo Mix (Realtek High Defini @device:cm:{33D9A762-90C8-11D0-BD43-00A0C911CE86}\Stereo Mix (Realtek High Defini

System Time Video Sample Count  Video Sample Time   Relative Video Sample Time  Audio Sample Count  Audio Sample Time   Relative Audio Sample Time
30439   907 30381   -57 304 30291   -147

Or you might prefer pasting it onto Excel:

CapptureClock Output on Excel

By the way, this is also an easy way to ensure devices are operational and check effective video frame rate.

Download links:

DirectShow Spy: ROT fix and evrprop.dll

A small issue appears to be affecting DirectShow applications with DirectShow Spy installed. As underlying COM base is non-standard, the spy implements a few hacks to run smoothly and to keep reference counting correct in particular. Under certain conditions, DirectShow-enabled ActiveX control hosted by Internet Explorer seems to be unable to put its graph onto Running Object Table (ROT). What happened next is that Spy assumed ROT operation to succeed, and compensated reference counting, which under bad assumption could cause E_UNEXPECTED error while creating a filter graph. This updated fixes the issue.

Another small improvement is that similarly to SDK proppage.dll, Spy registration UI also assists in registering another DLL – evrprop.dll, should it be there near the spy module.

Evrprop.dll registration

Download links

Bringing virtual DirectShow devices back to life with Skype 6

As mentioned before, new Skype 6 broke compatibility with all virtual DirectShow devices out there. Just oops, nothing works any longer if only it is not a full driver exposing virtual device through WDM.

Since quite some people are interested in details (Skype 6 Virtual Camera issues, Skype Client for Windows – SCW-3881 – Virtual cameras no longer work with Skype 6), here goes a bit of relevant information on the problem.

New Skype still uses DirectShow as API to interface capture devices and to discover such it enumerates them the way all decent applications do: Enumerating Devices and Filters. Presumably, there was a good reason to touch the video capture code and from moderately terrible it started being even worse. Skype guys decided that if a video device does not have a DevicePath property then it is not good enough for them.

The “DevicePath” property is not a human-readable string, but is guaranteed to be unique for each video capture device on the system. You can use this property to distinguish between two or more instances of the same model of device.

The documentation is unfortunately confusing in this part and perhaps developers thought they were doing the right thing, nevertheless multiple discussions online suggest a different approach.

Unfortunately, DevicePath is not a mandatory property. And it does not exist in virtual devices, and you cannot use it to distinguish between them. And Skype started – supposedly – skipping devices without it. And this is why all virtual devices were left overboard.

Virtual devices are not that rare. It might not only be a gate into IP camera, instead it might be a device that splits exclusive use type video camera device between applications, or something that adds an overlay onto captured image. That is, the whole class of devices failed to work with Skype from there. Including, of course, IP Video Source which is a virtual DirectShow device with the backend network connection into an IP camera or video encoder.

Adding missing DevicePath is the key to fix the problem and give Skype what it thinks is a must. Let’s hope we have a fix from Skype soon and there is no need in working things around any longer, but if someone needs a quick solution – it also exists (apart from rewriting everything into kernel mode driver, and other hackery).

Since the properties an application reads from IPropertyBag interface (which is in turn obtained from IMoniker when enumerating devices) are [partially] backed by system registry, it is sufficient to add “DevicePath” value into specific key of the registry and make the fake property available for those devices that don’t have kernel path.

The registry key is located under HKLM, SOFTWARE\Classes\CLSID\{860BB310-5D01-11d0-BD3B-00A0C911CE86}\Instance (note it’s SOFTWARE\Classes\Wow6432Node\CLSID... in 64-bit OS for 32-bit app space), where every subkey corresponds to a registered device (find yours there). Note that CLSID above is actually CLSID_VideoInputDeviceCategory.

Adding new value there will create a fake property on the property bag and improve compatibility with such picky software as Skype. Note that the value will be destroyed with re-registration of the device filter, and will have to be created once again.

DirectShow Spy: Easier Registration

Because DirectShow Spy is often a troubleshooting tool, one of its use scenarios is its being a drop-in module to quickly install on a system of interest in order to connect to graphs for troubleshooting purposes, such as to check topology and media types.

Its installation requires COM registration, and over time it changed gradually from simple to more and more complex step. Why? In Windows XP one had to open command prompt and regsvr32. With Vista’s UAC one needs a prompt, with privilege elevation, which opens typically in wrong directory, then UAC prompt. A relatively easy step became annoying multi-step operation. Then proxy/stub classes were moved into Windows SDK DLL…

Things are getting back to be easier with DirectShow Spy. It is given a special property sheet right there withing the DLL, to take care of all the important things:

  • checks registration status
  • buttons to Unregister/Register
  • per-user registration (not recommended though due to system wide class hooking)
  • automatically takes care of UAC prompt
  • place Windows SDK proppage.dll into the same directory near spy, and additional property page will help you to register this additional dependency

To invoke registration UI, start:

rundll32 DirectShowSpy.dll,DoRegistrationPropertySheetModal

from command line, or just have a .BAT file ready to do it for you.

Download links