DirectShow SmartTee behaviour on Windows 8

1

What I am trying to do

I am trying to create a sample USB camera streaming application (more or less like stripped version of amcap) using DirectShow framework with VC++ language using VS2008. Following is the filter graph information that I use to build.

Filter Graph

Web Camera (Capture Pin) - Smart Tee (Preview Pin) - Transform filter converting monochrome Y8 to YUY2 - Video Mixing Render.

Additional Info

  • Web Camera streams at 640x480, Y8 @ 30FPS.
  • Tested on Windows 7 Professional, Intel i3 - Works Good, able to stream VGA @ 30FPS.
  • No Preview Pin available in video capture filter.

Issue

With the same filter graph setup, I am facing issue on Windows 8 Intel i3 PC. But, if I replace Smart Tee filter with Infinte Tee sample provided in Microsoft SDK, it is working good. Why is it so that smart tee filter is not working in Windows 8?

EDIT: Issue is that I'm not able to connect video capture filter to smart tee filter on Windows 8, but able to connect on Windows 7. I tried through graphedit tool. Windows 8 is trying to form following graph for Y8 media sub type (YUY2 is working correctly).

Web Camera (Capture Pin) - Transform filter converting monochrome Y8 to YUY2 - Smart Tee (Preview Pin) - Video Mixing Render.

And when I run the graph, graphedit closes with exception.

If I do not register transform filter, I receive this error when connecting Capture filter with smart tee. 'These filters cannot agree on a connection. Verify type compatibility of input and output pin. No combination of intermediate filter could be found to make connection. (Return code = 0x80040217)'.

Also, if I use Infinte tee filter, there is frame rate drop after every few minutes. What is the difference between smart tee filter on Windows 7 and Windows 8? What can be used as alternate to smart tee?

Thanks in advance for your help.

visual-studio-2008
windows-8
camera
directshow
platform-sdk
asked on Stack Overflow Oct 16, 2013 by Spark • edited Oct 17, 2013 by Spark

2 Answers

1

It is unlikely that Smart Tee Filter is not good - it's hardly any different from that in Windows 7. Instead the likely place for the issue is the camera driver and Y8 format in particular. I would look for issues in this media type which causes connection problems OR you might want to choose a more popular format such YUY2/YV12 via IAMStreamConfig::SetFormat or via property page OR the Y8 format in question is interlaced and defined by VIDOINFOHEADER2 which is not supported by tee. Or, you might just need a driver update for the camera hardware.

The rate dropping issue with Inf Tee Filter again suggests that you need to check camera driver.

Smart Tee vs. Infinite Pin Tee

Both are splitters and it is typical question when there is a trouble with the one, then if it is really possible to replace it with another.

Both filters implement a pretty simple task, and both filters implement their own trick on purpose. Smart Tee filter strips time stamps to convert live feed into good for preview. For capture purposes quite so often you don't care much about latency as long as the stream integrity is intact and frames are good relative one to another. For presentation purposes you typically have time stamps being matched against clock, and you don't need it on live preview because all you want is to display a frame ASAP as soon as you have it. This is where Smart Tee is applicable, and it's not good for anything else.

On the contrary, Infinite Pin Tee filter is duplicating input feed without modifications. so it does not do what you would expect for live video preview and replacing one filter with the other directly just does not do the expected job. The filter is not even capable to copy/duplicate data and for this reason it shares memory allocator between its output pins, which potentially creates a number of issues. Yet it does the duplicating job and adds minimal overhead.

Additionally, Inf Pin Tee like filter is available in source code as Windows SDK sample \Samples\multimedia\directshow\filters\inftee.

A quick'n'dirty replacement for Smart Tee filter with Inf Pin Tee filter is like this:

Capture -> Inf Tee -> Sample Grabber -> ...

Where Sample Grabber is set to call SampleCB back where your callback will remove time stamps from video frames. This way you can replace one tee with the other for live preview purposes.

answered on Stack Overflow Oct 17, 2013 by Roman R. • edited Oct 17, 2013 by Roman R.
0

Hope this is clear now with how I defined my Y8 transform filter. And I'm validating in my transform filter for VIDEOINFOHEADER and not VIDEOINFOHEADER2.

 DEFINE_GUID(MEDIASUBTYPE_Y8, 
 0x20203859, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71);

// Media Types
const AMOVIESETUP_MEDIATYPE sudInputPinTypes[] =   
{ 
    {
        &MEDIATYPE_Video,
        &MEDIASUBTYPE_Y8
    }
};
const AMOVIESETUP_MEDIATYPE sudOutptuPinTypes[] =   
{ 
    {
        &MEDIATYPE_Video, 
        &MEDIASUBTYPE_YUY2
    }
};

// Pins
const AMOVIESETUP_PIN psudPins[] = 
{ 
    { 
        L"Input", 
        FALSE,
        FALSE, 
        FALSE, 
        FALSE, 
        &CLSID_NULL, 
        NULL,
        1, 
        sudInputPinTypes
    }, 
    { 
        L"Output", 
        FALSE, 
        TRUE, 
        FALSE, 
        FALSE, 
        &CLSID_NULL,
        NULL, 
        1, 
        sudOutptuPinTypes
    } 
};   

// Filters
const AMOVIESETUP_FILTER sudGrayScaleFilter =
{
    &CLSID_GrayScaleTransformFilter,        // Filter CLSID
    GRAYSCALE_FILTER_NAME,                  // String name
    MERIT_UNLIKELY,                         // Filter merit
    2,                                      // Number of pins
    psudPins                                // Pin information
};                   

// Templates
CFactoryTemplate g_Templates[]=
{
    { 
        GRAYSCALE_FILTER_NAME, 
        &CLSID_GrayScaleTransformFilter,
        CGrayScaleFilter::CreateInstance, 
        NULL, 
        &sudGrayScaleFilter
    }
};

Let me know whether you need further information to help me out:-)

Thank you.

answered on Stack Overflow Oct 18, 2013 by Spark

User contributions licensed under CC BY-SA 3.0