WMEncProfile2.GetCodecIndexFromFourCC

Windows Media Encoder SDK banner art

The GetCodecIndexFromFourCC method retrieves the audio or video codec index for a specific FOURCC value.

Syntax

Long = WMEncProfile2.GetCodecIndexFromFourCC(enumSrcType, lFourCC)

Parameters

enumSrcType

[in]  Member of a WMENC_SOURCE_TYPE enumeration type identifying the media stream type.

lFourCC

[in]  Long that represents an ASCII version of the FOURCC value.

To get the lFourCC value, determine the hexadecimal values of the four characters, combine them in reverse order, and then convert this value to a decimal.

For example, for the FOURCC value WMV3: W = 57, M = 4D, V = 56, and 3 = 33. Combined in reverse, the entire hexadecimal value is 33564D57. When converted to decimal (lFourCC), this value is 861293911.

Return Values

A Long containing the audio or video codec index.

Remarks

Four-Character Codes (FOURCC) is a set of codes used to identify data stream formats. FOURCC values are stored in file headers to describe the software technology and data format that was used to produce the multimedia data.

Use this method to find a particular codec if you know its FOURCC value.

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"

' Retrieve the video codec index from its FOURCC value.
  Dim lVid4CC As Long, lVidCodec As Long
  lVid4CC =  ' REPLACE WITH A FOURCC VALUE
  lVidCodec = Pro.GetCodecIndexFromFourCC(WMENC_VIDEO, lVid4cc)

Requirements

Reference: Windows Media Encoder

Library: wmenc.exe

See Also