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 Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document