2vision2
2vision2

Reputation: 5023

Playing video with QT

I want to create an application through which i need to play a video file with audio(need to play almost all kinds of videos).

I need it for Windows and Linux(atleast for windows).

I am planning to use QT or any other package?. How to do?

I need a GUI as http://www.youtube.com/watch?v=mA883X4uaHk (pl watch from .35s)

My Project Description: 1.Need to play a video in a thread 2.In an another thread. Parallely, need to capture the webcam video and need to process the
webcam frames with Opencv algorithms which plots the graphs.

Planning to duplicate the youtube video application. I have to use threads as well. And opencv supports QT .

What have i done: Used Java Media Framework to playback which fails as it dosn't support all the formats.

Upvotes: 0

Views: 6779

Answers (3)

Avanindra Singh
Avanindra Singh

Reputation: 59

Well , if you are willing to use Qt5 then Multimedia module has everything you need. You can access each frame of a video / camera and process it.You can use the same video surface to play video and and display web cam frames. There are simple examples in Qt5 multimedia widgets example directory , you can refer.

Upvotes: 1

Zlatomir
Zlatomir

Reputation: 7034

If you use Qt version 5 you can use QMediaPlayer and with version 4 you can use phonon module (look at examples, if i remember correctly they contain a simple video player).

Upvotes: 1

Givi
Givi

Reputation: 137

In OpenCV u can do sth like:

Mat frame;
VideoCapture vid("your_filename"); // open video file
if(!vid.isOpened()) // check if we succeeded
    return -1;
vid >> frame; //extract a frame

Later u can create QImage and initialize it with frame data, like:

QImage *img = new QImage(frame.data, frame.cols, frame.rows, QImage::Format_RGB888);

If Im not worng I just had a problem, that first taken frame was black, so I needed to do sth like: vid >> frame; Sleep(1); vid >> frame; Just in case it happens to u too.

Upvotes: 2

Related Questions