Does C++ include video libraries?

Hello,

Could anyone advise, in C++ if there are libraries to access each frame from a video and store the pixels in a 1d array.

I was hoping to create a background image, by taking the mean of all the frames of the video.

And would it be possible to make sure the pixels in the 1d array are in rgb format?

Thank you
EmailSurferAsked:
Who is Participating?
 
_corey_Commented:
Correct, C++ is only a language.  There is the standard C++ library but it does nothing like this.

The link I put in my earlier post has the example you seek but I forgot you need to download the SDK which has the samples in it:

http://www.microsoft.com/downloads/details.aspx?FamilyId=AFC15F29-D7C9-4CF7-A8D5-8AB81F14AE1B&displaylang=en ["DirectX 9.0 SDK Update - (April 2005)"] is the latest update.

The DirectShow components have lately been split into the Extras SDK for whatever reason: http://www.microsoft.com/downloads/details.aspx?familyid=8af0afa9-1383-44b4-bc8b-7d6315212323&displaylang=en ["DirectX 9.0 SDK Update (February 2005) Extras"]

I'm really hesitant to start you on this solution.  However, since you seem to want real-time access to an array of RGB values, this is the best way.  Otherwise, maybe there could be solutions using other software that can grab bitmaps or frame images.  Maybe an MEncoder windows port or other library?

corey
0
 
_corey_Commented:
Do you have any background in DirectX?  It will be simpler to direct you to a solution using DirectShow which will allow you to grab each frame of a video as it is being rendered.

corey
0
 
EmailSurferAuthor Commented:
Hello,

I have only used C++, at the moment I am using the Dev C++ editor.

To use DirectX, would I need to download a library to plug into my C++ version?

And would it be case C++ does not include a libraries to grab frames from a video?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
EmailSurferAuthor Commented:
I think my C++ editor also comes with OpenGl installed.

Do you know if OpenGL comes with any tools for capturing frames?

Thank you
0
 
_corey_Commented:
OpenGL doesn't connect with video files at all.

In DirectShow, you create render graphs.  These are essentially data flow from the input device (camera or video file) through transformations that take the input, convert it to a viewable/etc frame format.  Then the graph typically ends in a renderer or file save filter.

What you are able to do is insert a standard SampleGrabber filter in the middle of the graph.  This gives you access to every frame that travels through the graph from the video source.

I think there are issues with compiling DirectX applications under Dev-C++ but it is probably possible if you know what you're doing with C++ and Dev-C++.

DirectX/DirectShow require using certain COM interfaces and objects.  If you are uncomfortable with using these, then the solution will be very hard to read and understand.  

http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/directx9_c_Summer_03/directX/htm/grabbitmaps.asp ["GrabBitmaps Sample"] is the simplest example.

corey
0
 
EmailSurferAuthor Commented:
I will need to think about this, using DirectX would be quite difficult based on my knowlege of C++.

Have you seen any examples of DirectX frame capturing, I would be interested to look over the code to see if I could understand.

Also would I be correct in saying C++ it self does not have video capturing tools?

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.