Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6751293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:54:34+00:00 2026-05-26T12:54:34+00:00

I’m working with another directshow graph and can’t seem to wrap my head around

  • 0

I’m working with another directshow graph and can’t seem to wrap my head around the issue I’m seeing. When I snap the graph together in Graphedit it goes:

filesource -> demux -> decoder -> color converter dmo -> external render

This works perfect and playback is amazing!

But in code (and the graph builds perfectly without errors)… it doesn’t do what I want… instead it plays the file however the playback is very pixelated with blackness and it looks like it skips ontop of the previous frame never removing the prior frame.

Heres my code:

private static void BuildGraph(IGraphBuilder pGraph, string source)
{
    int hr = 0;

    // Graph builder.
    pBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
    hr = pBuilder.SetFiltergraph(pGraph);
    CheckHR(hr, "Can't SetFiltergraph.");

    // Add File Source (Async.).
    pFileSourceAsync = (IBaseFilter)new AsyncReader();
    hr = pGraph.AddFilter(pFileSourceAsync, "File Source (Async.)");
    CheckHR(hr, "Can't add File Source (Async.) to graph.");

    // Set source filename.
    pFileSourceAsync_src = pFileSourceAsync as IFileSourceFilter;

    if (pFileSourceAsync_src == null)
    {
        CheckHR(unchecked((int)0x80004002), "Can't get IFileSourceFilter.");
    }

    hr = pFileSourceAsync_src.Load(source, null);
    CheckHR(hr, "Can't load file.");

    // Add MPEG4 Demultiplexor.
    pMPEG4Demultiplexor = (IBaseFilter)Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_MPEG4Demultiplexor));
    hr = pGraph.AddFilter(pMPEG4Demultiplexor, "MPEG4 Demultiplexor");
    CheckHR(hr, "Can't add MPEG4 Demultiplexor to graph.");

    // Add Microsoft DTV-DVD Video Decoder.
    pMicrosoftDTVDVDVideoDecoder = (IBaseFilter)Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_MicrosoftDTVDVDVideoDecoder));
    hr = pGraph.AddFilter(pMicrosoftDTVDVDVideoDecoder, "Microsoft DTV-DVD Video Decoder");
    CheckHR(hr, "Can't add Microsoft DTV-DVD Video Decoder to graph.");

    // Add Color Converter DMO.
    dmoFilter = (IBaseFilter)new DMOWrapperFilter();
    dmoWrapper = (IDMOWrapperFilter)dmoFilter;
    hr = dmoWrapper.Init(CLSID_ColorConverterDMO, DMOCategory.VideoEffect);
    CheckHR(hr, "Can't initialize Color Converter DMO.");
    hr = pGraph.AddFilter(dmoFilter, "DMO Filter");
    CheckHR(hr, "Can't add Color Converter DMO to graph.");


    //IMediaParams dmoParams = dmoFilter as IMediaParams;
    //MPData srcLeft = new MPData();
    //MPData srcTop = new MPData();
    //MPData destLeft = new MPData();
    //MPData destTop = new MPData();
    //MPData width = new MPData();
    //MPData height = new MPData();
    //srcLeft.vFloat = 0;
    //srcTop.vFloat = 0;
    //destLeft.vFloat = 0;
    //destTop.vFloat = 0;
    //width.vFloat = 1280;
    //height.vFloat = 720;
    //dmoParams.SetParam(0, srcLeft);
    //dmoParams.SetParam(1, srcTop);
    //dmoParams.SetParam(2, destLeft);
    //dmoParams.SetParam(3, destTop);
    //dmoParams.SetParam(4, width);
    //dmoParams.SetParam(5, height);


    // Add Smart Tee.
    pSmartTee = (IBaseFilter)new SmartTee();
    hr = pGraph.AddFilter(pSmartTee, "Smart Tee");
    CheckHR(hr, "Can't add Smart Tee to graph.");

    // Add Decklink Video Render.
    pDecklinkVideoRender = CreateFilterByName(@"Decklink Video Render", CLSID_ExternalRenderers);
    hr = pGraph.AddFilter(pDecklinkVideoRender, "Decklink Video Render");
    CheckHR(hr, "Can't add Decklink Video Render to graph.");

    // Add AVI Decompressor.
    pAVIDecompressor = (IBaseFilter)new AVIDec();
    hr = pGraph.AddFilter(pAVIDecompressor, "AVI Decompressor");
    CheckHR(hr, "Can't add AVI Decompressor to graph.");

    // Add Color Space Converter.
    pColorSpaceConverter = (IBaseFilter)new Colour();
    hr = pGraph.AddFilter(pColorSpaceConverter, "Color Space Converter");
    CheckHR(hr, "Can't add Color Space Converter to graph.");

    // Add Null Renderer.
    pNullRenderer = (IBaseFilter)Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_NullRenderer));
    hr = pGraph.AddFilter(pNullRenderer, "Null Renderer");
    CheckHR(hr, "Can't add Null Renderer to graph.");

    // Connect File Source (Async.) and MPEG4 Demultiplexor.
    hr = pGraph.ConnectDirect(GetPin(pFileSourceAsync, "Output"), GetPin(pMPEG4Demultiplexor, "Input"), null);
    CheckHR(hr, "Can't connect File Source (Async.) and MPEG4 Demultiplexor.");

    // Connect MPEG4 Demultiplexor and Microsoft DTV-DVD Video Decoder.
    hr = pGraph.ConnectDirect(GetPin(pMPEG4Demultiplexor, "Video 1"), GetPin(pMicrosoftDTVDVDVideoDecoder, "Video Input"), null);
    CheckHR(hr, "Can't connect MPEG4 Demultiplexor and Microsoft DTV-DVD Video Decoder.");

    // Connect Microsoft DTV-DVD Video Decoder and Color Converter DMO.
    hr = pGraph.ConnectDirect(GetPin(pMicrosoftDTVDVDVideoDecoder, "Video Output 1"), GetPin(dmoFilter, "in0"), null);
    CheckHR(hr, "Can't connect Microsoft DTV-DVD Video Decoder and Color Converter DMO.");

    // Connect Color Converter DMO and Smart Tee Filter.
    hr = pGraph.ConnectDirect(GetPin(dmoFilter, "out0"), GetPin(pSmartTee, "Input"), null);
    CheckHR(hr, "Can't connect Color Converter DMO and Smart Tee Filter.");

    // Connect Smart Tee Filter and Decklink Video Render.
    hr = pGraph.ConnectDirect(GetPin(pSmartTee, "Capture"), GetPin(pDecklinkVideoRender, "In"), null);
    CheckHR(hr, "Can't connect Smart Tee Filter and Decklink Video Render.");

    // Add SampleGrabber.
    pSampleGrabber = (IBaseFilter)Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_SampleGrabber));
    hr = pGraph.AddFilter(pSampleGrabber, "SampleGrabber");
    CheckHR(hr, "Can't add SampleGrabber to graph.");
    (pSampleGrabber as ISampleGrabber).SetBufferSamples(true);
    (pSampleGrabber as ISampleGrabber).SetOneShot(false);

    // Connect Smart Tee and SampleGrabber.
    hr = pGraph.ConnectDirect(GetPin(pSmartTee, "Preview"), GetPin(pSampleGrabber, "Input"), null);
    CheckHR(hr, "Can't connect Smart Tee and SampleGrabber.");

    // Connect SampleGrabber and AVIDecompressor.
    hr = pGraph.ConnectDirect(GetPin(pSampleGrabber, "Output"), GetPin(pAVIDecompressor, "XForm In"), null);
    CheckHR(hr, "Can't connect SampleGrabber and AVIDecompressor.");

    // Connect AVIDecompressor and Color Space Converter.
    hr = pGraph.ConnectDirect(GetPin(pAVIDecompressor, "XForm Out"), GetPin(pColorSpaceConverter, "Input"), null);
    CheckHR(hr, "Can't connect Color Space Converter and SampleGrabber.");

    // Connect Color Space Converter and Null Renderer.
    hr = pGraph.ConnectDirect(GetPin(pColorSpaceConverter, "XForm Out"), GetPin(pNullRenderer, "In"), null);
    CheckHR(hr, "Can't connect Color Space Converter and Null Renderer.");

    // Set SampleGrabber Media Type.
    AMMediaType pSampleGrabber_pmt = new AMMediaType();
    pSampleGrabber_pmt.majorType = MediaType.Video;
    pSampleGrabber_pmt.subType = MediaSubType.RGB32;
    pSampleGrabber_pmt.formatType = FormatType.VideoInfo;
    VideoInfoHeader pSampleGrabber_format = new VideoInfoHeader();
    pSampleGrabber_pmt.formatPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(pSampleGrabber_format));
    Marshal.StructureToPtr(pSampleGrabber_format, pSampleGrabber_pmt.formatPtr, false);
    hr = ((ISampleGrabber)pSampleGrabber).SetMediaType(pSampleGrabber_pmt);
    DsUtils.FreeAMMediaType(pSampleGrabber_pmt);
    CheckHR(hr, "Can't set media type to sample grabber.");
}

You’ll see that I have more to the code such as hooking up a smart tee and a sample grabber (this isn’t the cause as I’ve commented it out before to check the result and no change, eventually i want to grab still images from the video stream… so I have it in place when ready).

I think the issue is with the color converter dmo but I’m not entirely sure… the exact graph in graphedit runs without any issues however code mode gives me horrible playback. Maybe theres something I’m forgetting to do with the color converter dmo? Or the wrapper? Any ideas would be greatly appreciated.

Thanks,
Cheers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:54:35+00:00Added an answer on May 26, 2026 at 12:54 pm

    I don’t have details about Color Converter DMO, but from experience with other Vista+ DMOs – they are not intended for use within DirectShow. Yes, they are still DMOs, with IMediaObject interface implemented, DMO Wrapper Filter is also there but small issues are ruining the integration.

    If it does not work out of the box, most likely you will have to put the DMO inside your own wrapper filter. This will definitely work out, and – good news – it is not that complicated.

    Older DMOs were definitely tested for use within DirectShow with stock wrapper filter, this is why they have been working and this is why DMO Wrapper Filter is available in first place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.