[Solved] Grab frames from video
i want to grab frames from a video. I'm new to qt and i'm using qt 4.7.
User starts video -> stops -> Now I want to grab for instance all 30 frames before this position and all 20 frames after this position for further computations.
I have looked through the documentation, but neither phonon nor qtmultimedia seem to be capable of accessing single video frames.
Now my question is, is it possible with qt 4 or do I have to call libs like ffmpeg directly?
Also will qt5 provide such methods?
I can't speak for the Qt5 code, but I believe you currently have to talk to the libs directly to get that fine-grained control.
If anyone is interested in this topic, I solved it with opencv (VideoCapture), which seems to be the easiest way to grab frames from a video.
I would appreciate if you could provide sample code.
Well, for the opencv part I recommend the documentation, which explains very good how the VideoCapture class works ( "link":http://opencv.willowgarage.com/documentation/cpp/highgui_reading_and_writing_images_and_video.html?highlight=videocapture#VideoCapture )
With opencv you get a frame as "Mat"
Now I converted it to a IplImage, like this:
Mat mat = whereveritcomesfrom...
What is very cheap, because it only changes the header, but not the data.
Then I adapted code from this "blog":http://umanga.wordpress.com/2010/04/19/how-to-covert-qt-qimage-into-opencv-iplimage-and-wise-versa/ , which converts the IplImage to a QImage :)
Thanks for the information Ashika Umanga!