C Source
IltmmCapture* pCapture;
CoCreateInstance(&CLSID_ltmmCapture, NULL, CLSCTX_INPROC_SERVER, &IID_IltmmCapture, (void**)&pCapture);
C++ Source
IltmmCapture* pCapture;
CoCreateInstance(CLSID_ltmmCapture, NULL, CLSCTX_INPROC_SERVER, IID_IltmmCapture, (void**) &pCapture);
C Source
IltmmDevices* pDevices;
// get an interface into video devices collection
IltmmCapture_get_VideoDevices(pCapture, &pDevices);
// select the first video device
IltmmDevices_put_Selection (pDevices, 0);
// release collection
IUnknown_Release(pDevices);
C++ Source
IltmmDevices* pDevices;
// get an interface into video devices collection
pCapture->get_VideoDevices(&pDevices);
// select device
pDevices->put_Selection(0);
// release collection
pDevices->Release();
C Source
BSTR bstr;
// create a string containing the target file path
bstr = SysAllocString(L"c:\\target.mpg");
// assign the target file path to the capture object
IltmmCapture_put_TargetFile (pCapture, bstr);
// free the string
SysFreeString(bstr);
C++ Source
BSTR bstr;
// create a string containing the target file path
bstr = SysAllocString(L"c:\\target.mpg");
// assign the target file path to the capture object
pCapture->put_TargetFile (bstr);
// free the string
SysFreeString(bstr);
C Source
long index;
IltmmCompressors* pCompressors;
// select the MS MPEG-4 Video Codec
IltmmCapture_get_VideoCompressors(pCapture, &pCompressors);
bstr = SysAllocString(L"@device:sw:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\\Microsoft MPEG-4 Video Codec V2");
IltmmCompressors_Find(pCompressors, bstr, &index);
SysFreeString(bstr);
if(index >= 0)
IltmmCompressors_put_Selection(pCompressors, index);
IUnknown_Release(pCompressors);
// select the MP3 audio video compressor
IltmmCapture_get_AudioCompressors(pCapture, &pCompressors);
bstr = SysAllocString(L"@device:cm:{33D9A761-90C8-11D0-BD43-00A0C911CE86}\\85MPEG Layer-3");
IltmmCompressors_Find(pCompressors, bstr, &index);
SysFreeString(bstr);
if(index >= 0)
IltmmCompressors_put_Selection(pCompressors, index);
IUnknown_Release(pCompressors);
C++ Source
IltmmCompressors* pCompressors;
long index;
// select the MS MPEG-4 Video Codec
pCapture->get_VideoCompressors (&pCompressors);
bstr = SysAllocString(L"@device:sw:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\\Microsoft MPEG-4 Video Codec V2");
pCompressors->Find (bstr, &index);
SysFreeString(bstr);
if(index < 0)
{
// compressor isn't registered
pCompressors->Release ();
return E_FAIL;
}
pCompressors->put_Selection (index);
pCompressors->Release();
// select the MP3 audio video compressor
pCapture->get_AudioCompressors (&pCompressors);
bstr = SysAllocString(L"@device:cm:{33D9A761-90C8-11D0-BD43-00A0C911CE86}\\85MPEG Layer-3");
pCompressors->Find (bstr, &index);
SysFreeString(bstr);
if(index < 0)
{
// compressor isn't registered
pCompressors->Release ();
return E_FAIL;
}
pCompressors->put_Selection (index);
pCompressors->Release();
C Source
IltmmCapture_EditGraph(pCapture);
C++ Source
pCapture->EditGraph();
C Source
IltmmTargetFormats* pTargetFormats;
IltmmTargetFormat* pTargetFormat;
IltmmCapture_get_TargetFormats(pCapture, &pTargetFormats);
// retrieve collection item
IltmmTargetFormats_Item(pTargetFormats, 0, &pTargetFormat);
// assign the required Mux
// this case: AVI
bstr = SysAllocString(L"@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\\{E2510970-F137-11CE-8B67-00AA00A3F1A6}");
IltmmTargetFormat_put_Mux(pTargetFormat, bstr);
SysFreeString(bstr);
// assign the optional SinkSubType
// this case: MEDIASUBTYPE_Avi
bstr = SysAllocString(L"{E436EB88-524F-11CE-9F53-0020AF0BA770}");
IltmmTargetFormat_put_SinkSubType(pTargetFormat, bstr);
SysFreeString(bstr);
// assign an optional Sink
// this case: default
bstr = SysAllocString(L"");
IltmmTargetFormat_put_Sink(pTargetFormat, bstr);
SysFreeString(bstr);
IUnknown_Release(pTargetFormat);
C++ Source
IltmmTargetFormats* pTargetFormats;
IltmmTargetFormat* pTargetFormat;
pCapture->get_TargetFormats(&pTargetFormats);
// retrieve collection item
pTargetFormats->Item(0, &pTargetFormat);
// assign the required Mux
// this case: AVI
bstr = SysAllocString(L"@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\\{E2510970-F137-11CE-8B67-00AA00A3F1A6}");
pTargetFormat->put_Mux(bstr);
SysFreeString(bstr);
// assign the optional SinkSubType
// this case: MEDIASUBTYPE_Avi
bstr = SysAllocString(L"{E436EB88-524F-11CE-9F53-0020AF0BA770}");
pTargetFormat->put_SinkSubType(bstr);
SysFreeString(bstr);
// assign an optional Sink
// this case: default
bstr = SysAllocString(L"");
pTargetFormat->put_Sink(bstr);
SysFreeString(bstr);
pTargetFormat->Release();
C Source
// set rate to 30 fps
IltmmCapture_put_UseFrameRate(pCapture, VARIANT_TRUE);
IltmmCapture_put_FrameRate(pCapture, 30.0);
// you should check with their particular compressor which frame rates are supported.
C++ Source
// set rate to 30 fps
pCapture->put_UseFrameRate(VARIANT_TRUE);
pCapture->put_FrameRate(30.0);
// you should check with their particular compressor which frame rates are supported.
C Source
// start running
IltmmCapture_StartCapture(pCapture, ltmmCapture_Mode_VideoAndAudio);
C++ Source
// start running
pCapture->StartCapture(ltmmCapture_Mode_VideoAndAudio);
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