Share via


IWMEncStatistics.EncodingTime

Windows Media Encoder SDK banner art

The EncodingTime property retrieves the encoding time that has elapsed in the current source.

Syntax

decimal = IWMEncStatistics.EncodingTime;

Parameters

This property takes no parameters.

Property Value

A Decimal that indicates the elapsed encoding time. To retrieve this value in seconds, multiple by 10.

Remarks

If the source is live, the elapsed time is measured from the time at which you start encoding the current source to the moment at which EncodingTime is processed (real time and the elapsed time in the source are the same.)

If the source is a file, the elapsed time corresponds to the amount of time in the source file that has elapsed during encoding. For example, if it takes 10 seconds to encode a file with a duration of one minute, after 10 seconds into the encoding session, the EncodingTime property returns 60 seconds. To determine how much of the current source you have finished encoding (percent completed), divide the value of EncodingTime by the source duration (call IWMEncVideoSource2.Duration or IWMEncAudioSource.Duration).

This property is read-only.

Example Code

using WMEncoderLib;

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

// Configure the encoding session including the sources, output,
// and profile, then start encoding.

// You can create a timer control to retrieve the statistics
// (as follows) after you start the encoding session.

// Declare objects and variables.
  IWMEncStatistics Stats;
  decimal lEncTime;

// Retrieve a IWMEncStatistics object.
  Stats = Encoder.Statistics;

// Find the encoding time, in seconds.
  lEncTime = Stats.EncodingTime * 10;
}

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

Requirements

Reference: Windows Media Encoder

Namespace: WMEncoderLib

Assembly: Interop.WMEncoderLib.dll

Library: WMEncoderLib.dll

See Also