I'm trying to install a mpeg2 DirectShow decoder on Windows7/Vista machines.
With no user interaction (programatically via script or command line or C#)
how do we make a different decoder to be the default on this operating
We have tried changing merits for all the 3rd party filters (eg. MainConcept
filter for mpeg2) but it doesn't seem to work. The only way we got this
working to manually hack the registry (take ownship and change permissions and
In order to change the registry in windows 7
(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\Preferred) we need to
take the ownership of the registry which is a manual process. I can't find any
programmatic ways to overcome this. Soon as DVT-DVD fiter is removed/change
from the proffered filter role it works fine. If someone find a way to change
it would be great,
Some other best diplomatic solution is more than welcome :)
Thanks in advance for your help...
If you know the graph you want to build I would manually build it end to end .
This way you do not need to rely on the default filters. You can test from
code to make sure the filters you need are there and then load the filters and
manually plug the pins together. This is how we do it in our software and it
Based on different versions of windows you may have to build different
playback graphs as the available filters can vary from version to version. The
way we do this is we built our own graph builder that takes a config file.
This way we can define different graphs per supported file formant and version
Hope this helps.
Thanks for your comments. I did installed MainConcept filter for mpeg2 and
MediaLooks filter for .mov. Those filters are latest. As you said I did the
same. I can manually change the filter to whatever the filter I want to, but
by default Microsoft's DVT-DVD filter takes the ownership (that is what the
above graph shows).
I'm using C# wrapper for DirectShow and it does pickup DVT-DVD filter
(Microsoft's). I'm doing playback for many formats, so how can I get rid of
this Microsoft's DVT-DVD filter. OR how can I make the MainConcept filter as
the default one to play.
Microsoft has had all kinds of problems with 3rd party filters installing
themselves with higher priority than system filters. Which wouldn't be a
problem, except some of these 3rd party filters are crap.
In W7, ms has decided to do something about it. I believe you can control some
of this with IAMPluginControl.
The simplest answer is yes you can force the filters if you hack the registry.
But the better way is to do the graph build your self.
You should be able to change the filter priorties but I have had issue with
this as when Medial Player updates are pushed some times they get switch back
to the defaults (Mostly in Vista). I would not fight the battle I would
manully create your own graphs with the filters you need. The auto builder is
not reliable for all formats. I have doing this for over four years now and
have found this to be the best method for getting the filter combinations that
I want for a given format. You could just do the manual builds on the formats
that are causing you issue and keep using the auto build for the others. Once
you get the hang of the manual build process you won't want to rely on the
auto build process again.
do not call render and do not use intelliconnect. manually add needed
decompressor and manually connect it. it works and tested with BDA in W7.
by the way, why you do not like MS DV-DTV filter? In my case I found that it
working better than Cyberlink's or any other filters I've tryed for MPEG2 and
Thanks for the comments. Creating my own graph sounds like a good idea, but in
such case i need to implement graphs for all sinarios (for different type of
files). Is there any ways I can add Microsft's DVT-DVD filter as a "not to use
@Zktech, can you give me a kick start code to create my own graph, that would
@salat The problem is my application need to do the playback for mpeg file
which are decoded as mpg2 in different settings, sometime it crashes the
application when it autometically loads Microsoft's filter, and getting
screeshot also fails due to that.
I just created a sample code of the playback I'm using, it might be helpful
for you to find pinpoint easily.
string filename = @"C:\blister\media\sample.mpg";
Control hWin = splitContainerMain.Panel1;
int hr = 0;
const int WMGraphNotify = 0x0400 + 13;
mGraphBuilder = (IGraphBuilder)new FilterGraph();
// QueryInterface for DirectShow interfaces
mMediaControl = (IMediaControl)mGraphBuilder;
mMediaEventEx = (IMediaEventEx)mGraphBuilder;
mMediaSeeking = (IMediaSeeking)mGraphBuilder;
// Have the graph signal event via window callbacks for performance
hr = mMediaEventEx.SetNotifyWindow(hWin.Handle, WMGraphNotify, IntPtr.Zero);
// create the SampleGrabber filter and config it
mSampGrabber = (ISampleGrabber)new SampleGrabber();
AMMediaType media = new AMMediaType();
media.majorType = MediaType.Video;
media.subType = MediaSubType.RGB24;
media.formatType = FormatType.VideoInfo;
// that's the call to the ISampleGrabber interface
media = null;
// we use BufferCB (i.e. 1) because we couldn't make SampleCB work
hr = mGraphBuilder.RenderFile(filename, null);
// Query for video interfaces, which may not be relevant for audio files
mBasicVideo = mGraphBuilder as IBasicVideo;
int videoWidth = 0;
int videoHeight = 0;
mBasicVideo.GetVideoSize(out videoWidth, out videoHeight);
// get the stride used for calculating the screenshot
media = new AMMediaType();
// GetConnectedMediaType retrieve the media type for a sample
hr = mSampGrabber.GetConnectedMediaType(media);
if ((media.formatType != FormatType.VideoInfo) || (media.formatPtr == IntPtr.Zero))
throw new Exception("Format type incorrect");
// save the stride
VideoInfoHeader videoInfoHeader = (VideoInfoHeader)Marshal.PtrToStructure(media.formatPtr, typeof(VideoInfoHeader));
int VideoStride = videoWidth * (videoInfoHeader.BmiHeader.BitCount / 8);
media = null;
mVideoWindow = mGraphBuilder as IVideoWindow;
hr = mVideoWindow.put_Owner(hWin.Handle);
hr = mVideoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipSiblings | WindowStyle.ClipChildren);
hr = mVideoWindow.SetWindowPosition(0, 0, splitContainerMain.Panel1.Width, splitContainerMain.Panel1.Height);
// Query for audio interfaces, which may not be relevant for video-only files
mBasicAudio = mGraphBuilder as IBasicAudio;
// Run the graph to play the media file
hr = mMediaControl.Run();
labelInfo.BackColor = Color.OliveDrab;
labelInfo.Text = "Playing video";
catch (Exception ex)
Console.WriteLine(ex.Message + ex.StackTrace);
labelInfo.BackColor = Color.Red;
labelInfo.Text = ex.Message;
I can look and see what code I could offer but it is all vb.net so I don't
know if that would help you.
I think you might try to render it first and then remove DTV-DVD fiter and
I still wonder why don't like it.. :)
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.