Elaborate on video acquisition on Microsoft Windows

What’s video

 

Video is the technology of electronically capturing, recording, processing, storing, transmitting, and reconstructing a sequence of still images representing scenes in motion. Video technology was first developed for television systems, but has been further developed in many formats to allow for consumer video recording. Video can also be viewed through the Internet as video clips or streaming media clips on computer monitors.

--from http://en.wikipedia.org/wiki/Video

 

It seems to me video is a container of still pictures. The container itself defined How fast the picture exchanged (Frame Rate, number of still pictures per second), what’s the pictures format (How the pictures compressed), how the video itself compressed….

 

Get video from video acquisition device in Microsoft Windows

 

Before you start the acquisition action, you may setup the format of the video (maybe say the format of still picture is more understandable). Say, first of all, get the current format which is used by the device(if you are not familiar with these serial capXXX, refer my article: Video Capture and play):

capGetVideoFormat( hwnd,  psVideoFormat, wSize );

Then Setup to a new format using:

capSetVideoFormat( hwnd,  psVideoFormat, wSize );

Here psVideoFormat is a pointer to The BITMAPINFO. BITMAPINFO structure defines the dimensions and color information for a DIB(Device Independent Bitmap, Know as BMP).

After you start the capture of the video, you can get the single picture data in the callback funtion:

LRESULT CALLBACK capVideoStreamCallback (HWND hWnd, LPVIDEOHDR lpVHdr)

{

     // lpVHdr->lpData contains the still picture data( DIB );

     // you can create a bitmap file using this data block, or collecting the every data block to form a video file, or draw it on a window.

     // here I only draw it on a window DC using a windows API DrawDibDraw.

     ::DrawDibDraw(hDib,

                                     hdc,

                                     0,                       // left pos

                                     0,                       // top pos

                                     -1, -1,               // don't zoom x,y

                                     bmpinfo->bmiHeader,  // bmp header info

                                  lpVHdr->lpData,            // bmp data

                                     0, 0,   WIDTH, HEIGHT,

                                    DDF_SAME_DRAW);

// you can also compressed it then send it to a host

// data  = Compress(lpVHdr->lpData, length)

// sendto(data);

 

    return TRUE;

}

 

Have funJ

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值