Adding Script Commands to Windows Media Video

This example shows how to access the ltmmWMScript object, using it to create script commands when converting to WMV video.

  1. Set the convert source, target and target format as follows:

    C API
    IltmmConvert_put_SourceFile(pConvert, L"source.avi"); 
    IltmmConvert_put_TargetFile(pConvert, L"target.wmv"); 
    IltmmConvert_put_TargetFormat(pConvert, ltmmConvert_TargetFormat_WMV_Mux); 
    C++
    pConvert->put_SourceFile(L"source.avi"); 
    pConvert->put_TargetFile(L"target.wmv"); 
    pConvert->put_TargetFormat(ltmmConvert_TargetFormat_WMV_Mux); 

  2. Call the convert object to retrieve the target filter as follows:

    C API
    IUnknown *pUnk; 
    IltmmConvert_GetSubObject(pConvert, ltmmConvert_Object_TargetFilter, &pUnk); 
    C++
    IUnknown *pUnk; 
    pConvert->GetSubObject(ltmmConvert_Object_TargetFilter, &pUnk); 

  3. Retrieve the ltmmWMScript interface as follows:

    C API
    IltmmWMScript *pWMScript; 
    IUnknown_QueryInterface(pUnk, &IID_IltmmWMScript, (void**)&pWMScript); 
    IUnknown_Release(pUnk); 
    C++
    IltmmWMScript *pWMScript; 
    pUnk->QueryInterface(&IID_IltmmWMScript, (void**)&pWMScript); 
    pUnk->Release(); 

  4. Add a header script at 5.0 seconds as follows:

    C API
    IltmmWMScript_AddHeaderScript(pWMScript, L"caption", L"Test Caption", 5.0); 
    C++
    pWMScript->AddHeaderScript(L"caption", L"Test Caption", 5.0); 

  5. Clean up the ltmmWMScript object as follows:

    C API
    IUnknown_Release(pWMScript); 
    C++
    pWMScript->Release(); 

  6. Start the conversion as follows:

    C API
    IltmmConvert_StartConvert(pConvert) 
    C++
    pConvert->StartConvert(); 

For the complete C example, refer to IltmmWMScript HeaderScripts Example for C.

For the complete C++ example, refer to IltmmWMScript HeaderScripts Example for C++.

To see how to handle script commands during playback, see Processing Script Commands During Windows Media Video Playback.

Help Version 22.0.2022.6.30
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Multimedia C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.