Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
how to store the captured video
Posted
Comments
Sergey Alexandrovich Kryukov 13-Jun-11 1:23am    
Store where? What's the problem?
--SA
Member 8000826 13-Jun-11 1:52am    
Iam a fresher new to VC++ itself.

iam able to capture the video but dont no to store it as a file and to view it again
Chandrasekharan P 13-Jun-11 2:31am    
How do you want to store the file?
[no name] 13-Jun-11 5:41am    
If you use C++ in Windows to capture and store data, then use directshow (directshow filters that work with camera).

The date that capture in camera is RGB data.
What format do you store?
 
Share this answer
 
Comments
dsant 12-May-12 12:29pm    
I too would like to know what is the format of raw data. Does not seem to be RGB, nor BGR, nor YUYV...
1. Create MFC project.

2. In the dialog make a Picture control and a Button , Picture control will Display the Video stream and the button will be used to capture a snapshot.Change Picture control to type Bitmap and attach a CStatic variable to it.

3. Now we will use a simple timer ( WM_TIMER ) to update the image being captured there are better way but this should do for a tutorial. In OnInitDialog() set the timer to refresh at say 10 times a second,
SetTimer(NULL,100,NULL)

4. Include the video videoInput.h header file. Also add the videoinput.lib in the linker input and for ignore library atlthunk.lib ( if it causes errors ).

5. Initialize the device using VideoInput API .

// in header
int device,width,height,size;
videoInput VI;
unsigned char * captureBuffer;
// in InitDoalog
device = 0; // first webcam
VI.setupDevice(device,320,240); // 320 x 240 resolution
width = VI.getWidth(device);
height = VI.getHeight(device);
size = VI.getSize(device); // size to initialize buffer
captureBuffer = new unsigned char[size]; // our capturebuffer

6. Now lets capture video and display frame in the OnTimer

if(VI.isFrameNew(device))
{
VI.getPixels(device,captureBuffer, false, true);
DisplayImage(&m_webcam,height,width,captureBuffer);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900