Create a File with One Video Stream
The following code can be used to create a file with one video stream:
// Create the profile manager object
hr = CoCreateInstance(CLSID_ltmmWMProfileManager, NULL, CLSCTX_INPROC_SERVER, IID_IltmmWMProfileManager, (void**) &m_pProfMan);
// create an empty profile
hr = m_pProfMan->CreateEmptyProfile(ltmmWMT_VER_7_0, &m_pProf);
// Set the profile name and description
hr = m_pProf->put_Name(L"Video_Stream_test");
hr = m_pProf->put_Description(L"Example code 1");
// add 1 video stream
// see the complete demo to check the AddVideoStream function code.
hr = AddVideoStream(m_pProfMan, m_pProf, 1, CODEC_VIDEO_WMV1, 200000, 320, 240, 25, 0, 4);
hr = m_pConvert->put_WMProfile(m_pProf);
m_pProf->Release();
m_pProfMan->Release();
//Set the target format
m_pConvert->put_TargetFormat(ltmmConvert_TargetFormat_Asf_Compressor_Mux);
// set the source file name
fname = "Hiway_AV.avi";
bstr = fname.AllocSysString();
m_pConvert->put_SourceFile(bstr);
SysFreeString(bstr);
// set the output file name
fname = "Hiway_V.asf";
bstr = fname.AllocSysString();
m_pConvert->put_TargetFile(bstr);
SysFreeString(bstr);
hr = m_pConvert->StartConvert();