Hello
I developed an application in C# using DirectShow.NET which can capture video from a source and create video.
I used several DirectShow filters such as ffdshow Deinterlace, Smart Tee, MPEG-2 Video Encoder, AVI Mux, File Writer and etc.
I want to change properties of MPEG-2 Video Encoder. I found this code:
but this code doesn't work.Code:IVideoEncoder videoEncoder = videoCompressorFilter as IVideoEncoder; object min, max, step; videoEncoder.GetParameterRange(PropSetID.ENCAPIPARAM_BitRate, out min, out max, out step); videoEncoder.SetValue(PropSetID.ENCAPIPARAM_BitRate, min);
After googling more I found this code which opens a filter's property window:
It works but it's settings/properties doesn't save! Every time I should change it's properties. It weird because everytime GraphEdit opens it's property window, properties are correct (they are what I set).Code:private void DisplayPropertyPage(IBaseFilter dev) { //Get the ISpecifyPropertyPages for the filter ISpecifyPropertyPages pProp = dev as ISpecifyPropertyPages; int hr = 0; if (pProp == null) { //If the filter doesn't implement ISpecifyPropertyPages, try displaying IAMVfwCompressDialogs instead! IAMVfwCompressDialogs compressDialog = dev as IAMVfwCompressDialogs; if (compressDialog != null) { hr = compressDialog.ShowDialog(VfwCompressDialogs.Config, IntPtr.Zero); DsError.ThrowExceptionForHR(hr); } else { MessageBox.Show("Item has no property page", "No Property Page", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return; } //Get the name of the filter from the FilterInfo struct FilterInfo filterInfo; hr = dev.QueryFilterInfo(out filterInfo); DsError.ThrowExceptionForHR(hr); // Get the propertypages from the property bag DsCAUUID caGUID; hr = pProp.GetPages(out caGUID); DsError.ThrowExceptionForHR(hr); //Create and display the OlePropertyFrame object oDevice = (object)dev; hr = OleCreatePropertyFrame(this.Handle, 0, 0, filterInfo.achName, 1, ref oDevice, caGUID.cElems, caGUID.pElems, 0, 0, IntPtr.Zero); DsError.ThrowExceptionForHR(hr); Marshal.ReleaseComObject(oDevice); if (filterInfo.pGraph != null) { Marshal.ReleaseComObject(filterInfo.pGraph); } // Release COM objects Marshal.FreeCoTaskMem(caGUID.pElems); }
What's wrong?
How can I change a filter's properties correcly?
Thanks
Regards
+ Reply to Thread
Results 1 to 1 of 1
Similar Threads
-
Directshow filter for the Animation codec
By roflwaffle in forum Video ConversionReplies: 8Last Post: 12th Oct 2010, 15:09 -
Directshow filter for decoding MPEG-2 TS
By roflwaffle in forum Video ConversionReplies: 5Last Post: 17th Aug 2010, 07:55 -
Directshow Source Filter Issue
By kakskulkarni in forum ProgrammingReplies: 0Last Post: 30th Jun 2010, 18:25 -
DirectShow Sample Grabber filter
By sunnyday28 in forum ProgrammingReplies: 2Last Post: 2nd Dec 2009, 03:26 -
DirectShow Filter Problems
By scoooter1 in forum SVCD2DVD & VOB2MPGReplies: 7Last Post: 2nd Oct 2008, 22:12