Adding Script Commands to Windows Media Video Example for Visual Basic

The following example shows how to add a script command to Windows Media Video:
 

Private Sub AddScriptCommandToConvertedWMV(Convert As ltmmConvertCtrl)

Dim WMScript As IltmmWMScript
 

' Set the source, target and target format for the conversion

Convert.SourceFile = "c:\source.avi"
Convert.TargetFile = "c:\target.wmv"
Convert.TargetFormat = ltmmConvert_TargetFormat_WMV_Mux

 

  ' call the Convert object to retrieve the video processors
Set WMScript = Convert.GetSubObjectDispatch (ltmmConvert_Object_TargetFilter)
 

' Add a caption script command at 5 seconds
WMScript.AddHeaderScript "caption", "Test Caption", 5.0

 

Set WMScript = Nothing
 

' start the conversion
Convert.StartConvert

End Select