Share via


IWMEncAudienceObj.VideoKeyFrameDistance

Windows Media Encoder SDK banner art

The VideoKeyFrameDistance property specifies and retrieves the video key frame interval.

Syntax

IWMEncAudienceObj.VideoKeyFrameDistance(iRenderSiteIndex) = WMENC_LONGLONG
WMENC_LONGLONG = IWMEncAudienceObj.VideoKeyFrameDistance(iRenderSiteIndex)

Parameters

iRenderSiteIndex

[in]  Integer containing the audience stream index. Because an audience can only contain one stream of each type, iRenderSiteIndex must be zero.

Property Value

A WMENC_LONGLONG indicating the key frame interval. When retrieving this value, divide by 1000 for seconds, and multiply the interval by 1000 when setting this value.

Remarks

The video key frame interval indicates the number of seconds that separates key frames. For high-motion content, use a smaller value, which results in more key frames and a larger file size. For content with static backgrounds, use a higher value, which results in fewer key frames and a smaller file size.

** Example Code**

' Create a WMEncProfile2 object.
  Dim Pro As WMEncProfile2
  Set Pro = New WMEncProfile2

' Load a custom profile. REPLACE THE FILE NAME.
  Pro.LoadFromFile "C:\Profiles\CustomProfile.prx"

' Create an IWMEncAudienceObj object, selecting the first audience (0)
' in the profile.
  Dim Audnc As IWMEncAudienceObj
  Set Audnc = Pro.Audience(0)

' Retrieve a value indicating the key frame interval.
' Divide by 1000 to retrieve the value in seconds.
  Dim lVidFrameInt As Long
  lVidFrameInt = Audnc.VideoKeyFrameDistance(0) / 1000

' Set a new value indicating the key frame interval.
' Multiply by 1000 to set the value in seconds.
  Audnc.VideoKeyFrameDistance(0) = 4000    ' 4 seconds

Requirements

Reference: Windows Media Encoder

Library: wmenc.exe

See Also