What I want to do is to get video frame at some time (for example at 20 sec). I know I could do something like this - rewind video and pause it:
QMediaPlayer* player = new QMediaPlayer;
...
player->play();
player->setPosition(20000);
player->pause();
But is there some more elegant solution (this seems like a hack to me since I don't need whole video but only a frame at some time)?
Below steps may help you to capture a frame from a video file.
Project level
Code level
Above said example application can be found here
(Application Screen Shot)
Open Video File : Browse and select a video file
Slider : select the position you want
Capture : capture the image and view in a QLabel
Save : Save the captured image