public int Compression {get;}
public:
property int Compression {
int get();
}
A value that represents the video compression of the video format.
This property is the video compression type of the video format. For compressed video and YUV formats, this member is a FOURCC code, specified as a DWORD value in little-endian order. For example, YUYV video has the FOURCC 'VYUY' or 0x56595559. For more information, see the Microsoft documentation on FOURCC Codes. For uncompressed RGB formats, the following values are possible: Value Meaning BI_RGB (0) Uncompressed RGB. BI_BITFIELDS (3) Uncompressed RGB with color masks. Valid for 16-bpp and 32-bpp bitmaps. For 16-bpp bitmaps, if biCompression equals BI_RGB, the format is always RGB 555. If biCompression equals BI_BITFIELDS, the format is either RGB 555 or RGB 565. Use the media subtype GUID to determine the specific RGB type. Use the CaptureCtrl.VideoCaptureFormats property to access the VideoFormats object that contains all of the formats available for the current capture device. The VideoFormats indexer obtains a VideoFormat object for each of the supported video formats. The properties of each object, obtained using the VideoFormats indexer, are updated with information about that specific video format. This information includes the following information:
using Leadtools;
using Leadtools.MediaFoundation;
using LeadtoolsMediaFoundationExamples.Fixtures;
public CaptureCtrlForm _form = new CaptureCtrlForm();
public bool _result = false;
public void VideoFormatExample()
{
// reference the capture control
CaptureCtrl capturectrl = _form.CaptureCtrl;
int count, compression = 0, bits = 0, width = 0, height = 0;
int found, selected = -1;
// set a video device, use the name of your device here
if (capturectrl.VideoDevices["USB"] != null)
capturectrl.VideoDevices["USB"].Selected = true;
// reference the videoformats property
VideoFormats videoformats = capturectrl.VideoCaptureFormats;
try
{
// get count of available video formats
count = videoformats.Count;
// enumerate formats and select one
foreach (VideoFormat vf in videoformats)
{
// get the properties
bits = vf.BitCount;
compression = vf.Compression;
width = vf.Width;
height = vf.Height;
// select the format if it matches some criteria
if (bits == 16 && width == 640 && height == 480)
{
vf.Selected = true;
break;
}
}
// get the currently selected format
selected = videoformats.Selection;
// find a format based on subtype name, width and height (YUY2 320 x 240 video)
found = videoformats.IndexOf(Constants.MEDIASUBTYPE_YUY2, 320, 240);
// our found format is not selected, so select it
if (found != selected)
videoformats.Selection = found;
// get the new selected format
selected = videoformats.Selection;
// set our result based on what we expect
_result = (count > 0 && selected == found);
}
catch (Exception)
{
_result = false;
}
}
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