使用avi格式的网络摄像头进行视频捕获

使用avi格式的网络摄像头进行视频捕获

本文介绍了使用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");

推荐答案



这篇关于使用avi格式的网络摄像头进行视频捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 17:23