Skip to main content

DScaler Deinterlace filter usage

Products: Video Capture SDK .Net, Video Edit SDK .Net, Media Player SDK .Net

DScaler Deinterlace filter (1.2) is one of the most popular DirectShow filters for deinterlacing. You can use this filter in our SDK and configure it.

Sample code

  1. We must define a filter interface and used enumerations.
    /// 
/// DScaler deinterlace type.
///
public enum DScalerDeinterlaceType
{
///
/// Weave.
///
Weave = 1020,

///
/// Bob.
///
Bob = 1021,

///
/// Two frame.
///
TwoFrame = 1022,

///
/// Blended clipping.
///
BlendedClipping = 1023,

///
/// Field bob.
///
FieldBob = 1024,

///
/// DScaler plugin.
///
DScalerPlugin = 1025
}

///
/// DScaler Deinterlace filter 1.2 interface.
///
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("463D645C-48F7-11D4-8464-0008C782A257")]
[ComImport, System.Security.SuppressUnmanagedCodeSecurity]
public interface IDeinterlace
{
///
/// Gets or sets deinterlace type.
///
[DispId(1)]
int DeinterlaceType
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get;
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set;
}

///
/// Gets or sets a value indicating whether odd field will be first.
///
[DispId(2)]
bool IsOddFieldFirst
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get;
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set;
}

///
/// Gets or sets DScaler plugin name.
///
[DispId(3)]
string DScalerPluginName
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
get; [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set;
}
}
  1. Add OnFilterAdded event handler for SDK control. In our sample code, we use Video Capture SDK .Net.
private void VideoCapture1_OnFilterAdded(object sender, FilterEventArgs e)
{
if (e.Name.Contains("Deinterlace Filter"))
{
IDeinterlace deint = e.Filter as IDeinterlace;
if (deint != null)
{
deint.DeinterlaceType = (int)DScalerDeinterlaceType.Bob;
deint.IsOddFieldFirst = false;
}
}
}

This event fired for each added filter. We're checking the filter name and getting the IDeinterlace filter interface. In our sample, we changing deinterlace method to Bob.

Before Start method call, you must add Deinterlace filter using the following code:

VideoCapture1.Video_Filters_Add(new CustomProcessingFilter("Deinterlace Filter"));

Required redists

  • SDK redist

How to install required redists or deploy them to the user's PC?


Visit our GitHub page to get more code samples.