用这个代码可以捕获视频!
void CServerPlusDlg::InitVideoCard()
{
this->m_hWndCapture=::capCreateCaptureWindow("Capture Window",WS_VISIBLE|WS_CHILD,0,0,320,240,this->m_hWnd,1);
capDriverConnect(this->m_hWndCapture,0);
//set the video format
capSetVideoFormat(this->m_hWndCapture,&this->m_InInfo,sizeof(BITMAPINFO));
capPreviewRate(this->m_hWndCapture,40);
// capDlgVideoFormat(this->m_hWndCapture);
capPreview(this->m_hWndCapture,TRUE);
capSetCallbackOnFrame(this->m_hWndCapture,FrameCallBack);
}
void CServerPlusDlg::InitVideoCard()
{
this->m_hWndCapture=::capCreateCaptureWindow("Capture Window",WS_VISIBLE|WS_CHILD,0,0,320,240,this->m_hWnd,1);
capDriverConnect(this->m_hWndCapture,0);
//set the video format
capSetVideoFormat(this->m_hWndCapture,&this->m_InInfo,sizeof(BITMAPINFO));
capPreviewRate(this->m_hWndCapture,40);
// capDlgVideoFormat(this->m_hWndCapture);
capPreview(this->m_hWndCapture,TRUE);
capSetCallbackOnFrame(this->m_hWndCapture,FrameCallBack);
}
可是这是VFW的简单调用
无法解决问题
dshow 的 preview 相当于 vfw 的 overlay
capture 相当于 vfw 的 preview
dshow 采集单帧图像很难,一般只能通过 capture pin ,不过这样会大大降低回放的速度,preview pin 上所有获取数据的功能都不好用,包括录像等,所以视频采集不推荐使用它(个人观点)。
direct show 的回放的大小可以通过拉伸修改的(这是video render的功能),效果一般不太好。
找一找采集卡新的驱动程序可能会解决问题
所以才到这儿来..
不过 dshow的preview的确很差,和VFW的Overlay(98下)无法相比
我现在正在看IOverlay,可能能解决一些问题
记得原来好像用IBasicVideo2捕获过单桢,应该可以吧??
正在测试之中
谢谢您的意见
98下好像很容易办到,可在2000下。。
好的
我会试试ISampleGrabber的:)不过我还是想用Overlay