I want to process frames with Qt. I use QMediaplayer to load a video. I used the implmentation I found here. I have additional data stored as "frame by frame values" in a .csv file.
For this I want to get the exact frame number of the current frame which is processed in the "present" function of my QAbstractVideoSurface implementation. It works while playing/stopping and pausing the video, but not when I attach a slider to the video...it seems that the QMediaplayer is out of sync with the data which is displayed. I tried getting the current time of the QMediaplayer while being in the QAbstractVideoSurface::present()
function but it just won't work. Setting the time from outside while the slider is being moved was also no success for me.
My main problem is that QVideoFrame::startTime()
and QVideoFrame::stopTime()
does not deliver correct results after QMediaPlayer::setPosition(int)
was called!
Does anyone have ideas how I get the current frame number for a QVideoFrame?