Windows Media Encoder SDK banner art

The FileSize property specifies and retrieves the file-size limit of the archived file.


decimal = IWMEncFile2.FileSize;
IWMEncFile2.FileSize = decimal;


This property takes no parameters.

Property Value

A Decimal indicating the size, in bytes, after which to stop archiving.


The FileSize property allows you to set a size limit for an archival file. When the file reaches the specified size, archiving stops.

To retrieve the correct file size in milliseconds, you must multiply the return value by 10,000. Divide by 10,000 when you set the value.

Example Code

using WMEncoderLib;

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

// Create a source group, add an audio source, and specify the
// default audio device as the source.
  IWMEncSourceGroupCollection SrcGrpColl;
  IWMEncSourceGroup SrcGrp;
  IWMEncSource SrcAud;
  SrcGrpColl = Encoder.SourceGroupCollection;
  SrcGrp = SrcGrpColl.Add("SG_1");
  SrcAud.SetInput("Default_Audio_Device", "Device", "");

// Create an IWMEncFile2 object.
  IWMEncFile2 File;
  File = (IWMEncFile2)Encoder.File;

// Specify an output file.
  File.LocalFileName = "C:\\Test.wmv";

// Specify a file size of 300 Kbytes.
  File.FileSize = (300000/10000);

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


Reference: Windows Media Encoder

Namespace: WMEncoderLib

Assembly: Interop.WMEncoderLib.dll

Library: WMEncoderLib.dll

See Also