使用avi格式的网络摄像头进行视频捕获
问题描述:
我正在开发一个项目,我想同时从两个不同侧面从两个网络摄像头捕获视频.
但是当我从两个摄像头开始录制时,它都显示"END RECORDING"状态;
但是当我开始录制单个网络摄像头时,它会录制视频.
我说的是用于录制的代码.
另外,我正在使用Microsoft Sdks的vfw32
库来实现此网络摄像头功能.
I am developing project in which I want to capture video from two webcam at same time from two different side.
But when I started recording from both webcam it shows "END RECORDING" status ;
But when I started recording single webcam it record a video.
I am mentioning the code used for recording.
Also I am using vfw32
library of Microsoft Sdks for this webcam functionality.
//CONNECTION FOR WEBCAM1
hMyWindow1 = capCreateCaptureWindow("", WS_CHILD |WS_VISIBLE,rect.left, rect.top,rect.right,rect.bottom, hw, 0);
capSetCallbackOnStatus( hMyWindow1, capStatusCallback1);
SendMessage(hMyWindow1,WM_CAP_DRIVER_CONNECT,0,0);
SendMessage(hMyWindow1, WM_CAP_SET_SCALE, true , 0);
SendMessage(hMyWindow1, WM_CAP_SET_PREVIEWRATE, 66, 0);
SendMessage(hMyWindow1, WM_CAP_SET_PREVIEW, true , 0);
SendMessage(hMyWindow1,WM_CAP_DLG_VIDEOSOURCE,0,0);
//CONNECTION FOR WEBCAM2
hMyWindow = capCreateCaptureWindow("", WS_CHILD |WS_VISIBLE,rect.left, rect.top,rect.right,rect.bottom, hw, 0);
capSetCallbackOnStatus( hMyWindow, capStatusCallback1);
SendMessage(hMyWindow,WM_CAP_DRIVER_CONNECT,0,0);
SendMessage(hMyWindow, WM_CAP_SET_SCALE, true , 0);
SendMessage(hMyWindow, WM_CAP_SET_PREVIEWRATE, 66, 0);
SendMessage(hMyWindow, WM_CAP_SET_PREVIEW, true , 0);
SendMessage(hMyWindow,WM_CAP_DLG_VIDEOSOURCE,0,0);
//RECORDING CODE
p=SendMessage(hMyWindow,WM_CAP_FILE_SET_CAPTURE_FILE , 0,(LPARAM) (LPVOID) cname1);
p= SendMessage(hMyWindow, WM_CAP_GET_SEQUENCE_SETUP, sizeof(CaptureParams),(LPARAM) (LPVOID)(LPCAPTUREPARMS)&CaptureParams);
CaptureParams.dwRequestMicroSecPerFrame=14286;/// its for 70 fps(1000000/70) bt giving fps of 60
CaptureParams.fYield=1;
//p= SendMessage(hMyWindow, WM_CAP_GET_SEQUENCE_SETUP, sizeof(CaptureParams),(LPARAM) (LPVOID)(LPCAPTUREPARMS)&CaptureParams);
p= SendMessage(hMyWindow, WM_CAP_SET_SEQUENCE_SETUP, sizeof(CaptureParams),(LPARAM) (LPVOID)(LPCAPTUREPARMS)&CaptureParams);
p=SendMessage(hMyWindow, WM_CAP_SEQUENCE, 0, 0);
p=SendMessage(hMyWindow1,WM_CAP_FILE_SET_CAPTURE_FILE , 0,(LPARAM) (LPVOID) cname2);
p= SendMessage(hMyWindow1, WM_CAP_GET_SEQUENCE_SETUP, sizeof(CaptureParams),(LPARAM) (LPVOID)(LPCAPTUREPARMS)&CaptureParams);
CaptureParams.dwRequestMicroSecPerFrame=14286;/// its for 70 fps(1000000/70) bt giving fps of 60
CaptureParams.fYield=1;
p= SendMessage(hMyWindow1, WM_CAP_SET_SEQUENCE_SETUP, sizeof(CaptureParams),(LPARAM) (LPVOID)(LPCAPTUREPARMS)&CaptureParams);
SendMessage(hMyWindow1, WM_CAP_SEQUENCE, 0, 0);
SetWindowText(GetDlgItem(hDlg, IDC_START_CAPTURE), "Stop Capture");
答
这听起来很愚蠢,但是正试图从2个不同的来源记录到同一文件中?可能是问题吗?!?
That may sound stupid, but are trying to record to the same file from 2 different sources? that might be the problem?!?
请确保为WM_CAP_DRIVER_CONNECT使用正确的索引值.
谢谢
Hi,
Please make sure that you are using the right index value for WM_CAP_DRIVER_CONNECT.
Thanks