IWMEncVideoSource2.PreProcessPass

Windows Media Encoder SDK banner art

The PreProcessPass property specifies and retrieves the preprocess pass count.

Syntax

short = IWMEncVideoSource2.PreProcessPass;
IWMEncVideoSource2.PreProcessPass = short;

Parameters

This property takes no parameters.

Property Value

An Int16 type that indicates the number of times to preprocess content (0, or 1 for two-pass encoding).

If this property fails, it returns an error number.

Return code Number Description
E_INVALIDARG 0x80070057 The preprocess value cannot be less than 0 or greater than 1.

Remarks

When you use two-pass encoding (PreProcessPass = 1), your content is analyzed in the first pass, and then the best combinations of bit rate, frame rate, buffer size, and image quality are applied during the second pass. Otherwise, content is analyzed and compressed during one pass (PreProcessPass = 0). Two-pass encoding produces a better-quality result and the process takes longer.

You can only use this feature for sources from audio files, video files, and digital devices; and when your output is saved to a file. Use the IWMEncAudioSource.PreProcessPass property to specify two-pass encoding for audio.

Example Code

using WMEncoderLib;

try
{
// Create a WMEncoder object.
  WMEncoder Encoder;
  Encoder = new WMEncoder();

// Create a source group and add the sources.
  IWMEncSourceGroupCollection SrcGrpColl;
  IWMEncSourceGroup SrcGrp;
  IWMEncSource SrcAud;
  IWMEncVideoSource2 SrcVid;
  SrcGrpColl = Encoder.SourceGroupCollection;
  SrcGrp = SrcGrpColl.Add("SG_1");
  SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
  SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
  SrcAud.SetInput("C:\\Sourcefile.avi", "", ""); // REPLACE WITH A VALID FILE NAME
  SrcVid.SetInput("C:\\Sourcefile.avi", "", ""); // REPLACE WITH A VALID FILE NAME

// Configure the output and profile for the encoding session.

// Specify two-pass encoding.
  SrcVid.PreProcessPass = 1;
}

catch (Exception e)
{
     // TODO: Handle exceptions.
}

Requirements

Reference: Windows Media Encoder

Namespace: WMEncoderLib

Assembly: Interop.WMEncoderLib.dll

Library: WMEncoderLib.dll

See Also