Create a File with One Video Stream and One Audio Stream

The following code can be used to create a file with one video stream and one audio stream:

BSTR bstr;   
CString fname;   
HRESULT hr;   
USES_CONVERSION;   
if(m_pConvert == NULL )   
   return;   
// 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 audio stream   
// see the complete demo to check the AddAudioStream function code.   
hr = AddAudioStream(m_pProfMan, m_pProf, 1, CODEC_AUDIO_MSAUDIO, 8000, 8000, 1, TRUE);   
// Add 1 video stream   
// see the complete demo to check the AddVideoStream function code.   
hr = AddVideoStream(m_pProfMan, m_pProf, 2, CODEC_VIDEO_WMV1, 200000, 320, 240, 25, 0, 4);   
// add the profile to the convert object   
hr = m_pConvert->put_WMProfile(m_pProf);   
m_pProf->Release();   
m_pProfMan->Release();   
//set the target format    
hr = m_pConvert->put_TargetFormat(ltmmConvert_TargetFormat_Asf_Compressor_Mux );   
// set the source file name:   
fname = "Hiway_AV.avi";   
bstr = fname.AllocSysString();   
hr = m_pConvert->put_SourceFile(bstr);   
SysFreeString(bstr);   
// set the output file name:   
fname = "Hiway_AV.asf";   
bstr = fname.AllocSysString();   
hr = m_pConvert->put_TargetFile(bstr);   
SysFreeString(bstr);   
hr = m_pConvert->StartConvert(); 

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

LEADTOOLS Multimedia C API Help