The following steps will split a large AVI into 2 smaller files.
Create an instance of the ltmmConvert class. This is accomplished using the Win32 CoCreateInstance function as follows:
IltmmConvert* pConvert;
CoCreateInstance(&CLSID_ltmmConvert, NULL, CLSCTX_INPROC_SERVER, &IID_IltmmConvert, (void**) &pConvert);
IltmmConvert* pConvert;
CoCreateInstance(CLSID_ltmmConvert, NULL, CLSCTX_INPROC_SERVER, IID_IltmmConvert, (void**) &pConvert);
Note:
Pick a compressor when splitting a non-AVI or a non-WAV file to avoid creating two huge uncompressed files.
Set the source file as follows:
BSTR bstr;
bstr = SysAllocString(L"c:\\Source.avi");
IltmmConvert_put_SourceFile(pConvert, bstr);
SysFreeString(bstr);
BSTR bstr;
bstr = SysAllocString(L"c:\\Source.avi");
pConvert->put_SourceFile(bstr);
SysFreeString(bstr);
Get the duration of the media as follows:
double fDur;
IltmmConvert_get_Duration(pConvert, &fDur);
double fDur;
pConvert->get_Duration(&fDur);
Save the first small avi file as follows:
bstr = SysAllocString(L"c:\\Avi1.avi");
IltmmConvert_put_TargetFile(pConvert, bstr);
SysFreeString(bstr);
IltmmConvert_put_SelectionEnd(pConvert, fDur/2);
IltmmConvert_StartConvert(pConvert);
BSTR bstr;
bstr = SysAllocString(L"c:\\Avi1.avi");
pConvert->put_TargetFile(bstr);
SysFreeString(bstr);
pConvert->put_SelectionEnd(fDur/2);
pConvert->StartConvert();
Save the second small avi file as follows:
bstr = SysAllocString(L"c:\\Avi2.avi");
IltmmConvert_put_TargetFile(pConvert, bstr);
SysFreeString(bstr);
IltmmConvert_put_SelectionStart(fDur/2);
IltmmConvert_put_SelectionEnd(pConvert, fDur);
IltmmConvert_StartConvert(pConvert);
bstr = SysAllocString(L"c:\\Avi2.avi");
pConvert->put_TargetFile(bstr);
SysFreeString(bstr);
pConvert->put_SelectionStart(fDur/2);
pConvert->put_SelectionEnd(fDur);
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