I am trying to capture a video from webcam (Logitech C170). So far i am able to capture the video and save it in .avi container.
My c++ code goes like this
using namespace std;
using namespace cv;
int main(int, char**)
{
VideoCapture capture(0);
.
.
.
.
VideoWriter video("record.avi", CV_FOURCC('M', 'J', 'P', 'G'), frame_rate, Size(frame_width,frame_height), true);
.
.
.
.
Mat frame;
.
.
.
.
for(;;)
{
capture >> frame;
video.write(frame);
}
return 0;
}
My next target is
Record Sleep Record
|<------------>|<------------>|<------------>| Goes for infinite loop...
3 Minutes 2 Minutes 3 Minutes
| | |
| | |
v v v
save to Cam goes to sleep save to
/records/1.avi /records/2.avi
I am using opencv-2.4.3, code is in c++.
Please let me know if any other information is required from my side.
How can i achieve this? Please give your valuable suggestions?
Thanks in advance.