Class Wrapper for Video Compression Manager (VCM)


The video compression manager (VCM) provides access to the
interface used by installable compressors to handle real-time
data. Typically applications use installable compressors to
perform compressing and decompressing video data. The simplest
solution for decompressing is using a DrawDib API, which is wraps
all necessary functionality and provide a simple way for
visualization of compressed images. The same approach has been
used in MCIWnd for displaying an AVI files. All in all, looks
like there is no reason to deal with low-level VCM API in most
cases excepting:

  1. Processing a real-time video data from capture card with h/w codec
  2. Compressing/decompressing AVI file and writing results to the disk
  3. Compressing and decompressing single video image.
    No comments about (1) and (2): this is the most usual way for
    utilizing VCM service. CVidc class presented
    below is intended for compressing and decompressing single video
    image, although it can be easy modified for any other purpose. I
    had a special reason for developing this class: in fact video
    codecs has an extremely high rate of decompression, no one from
    existing image compressors can compare with video codecs. At the
    same time, all of them are quite slow for compression. Thereby
    when you need to store many compressed images and provide the
    fastest reading, using the video codec seems to be the best

Class implementation.

CVidc class includes several methods from the list VCM
services for compressing and decompressing single video image.
Class does not support drawing (ICDrawXXX) and
sequence compressing (ICSeqCompressFrameXXX).

Class usage.

  1. Create CVidc class object
  2. Call OpenCompressor() method to initialize
    compressing, or suitable kind of OpenDecompressor()
    for decompressing.
  3. Setup your callback function using SetProgressCallback()
    method if you need a progress notification.
  4. Call Compress() or Decompress().
    If you need to decompress single image from sequence
    you can probably use DecompressEx(), which
    accepts special flags( see SDK for more info).
  5. Close codec using Close() method.

Class also provides a few services for querying format,
enumerating installed codecs, obtaining information from codec
and so on. See Vidc.h for more info.

Remark about capturing compressed video data.

I can predict some questions about using of CVidc
for capturing together with
wrapper presented earlier.
I did not test this combination. You can try to use DecompressEx()
method with proper conversion of VHDR_KEYFRAME (dwFlags
(dwFlags argument for DecompressEx()).


Download source – 4 Kb
Download demo project – 35 Kb

More by Author

Must Read