Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

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
0
EmailSurfer
Asked:
EmailSurfer
  • 3
  • 3
1 Solution
 
_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
 
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
_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
 
_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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now