I want to get every frames from a QMediaPlayer
and convert it to QImage
(or cv::Mat
)
so I used videoFrameProbed
You can use QImage's constructor:
QImage img( currentFrame.bits(),
currentFrame.width(),
currentFrame.height(),
currentFrame.bytesPerLine(),
imageFormat);
Where you can get imageFormat
from pixelFormat
of the QVideoFrame
:
QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(currentFrame.pixelFormat());