QVideoFrame::map() is false in android
Unsolved
QML and Qt Quick
-
Me again
I try to capture frame from camera using QCamera and QAbstractVideoSurface. Trying convert QVideoFrame to QImage in present() function but map() return fail when run on android 9, API 28This working find on linux
PixelFormat had test: Format_RGB32,Format_RGB565,Format_Jpeg
any i idead how to convert QVideoFrame to QImage on android ? Or other way to grap camera frame
-
Hi,
How are you mapping your video frame ?
Note that on Android, IIRC; you get an OpenGL texture.
-
here how i convert QVideoFrame to QImage to display
bool AndroidFrame::present(const QVideoFrame ¤tFrame) { qDebug()<<currentFrame.pixelFormat()<<currentFrame.isValid()<<endl; if (currentFrame.isValid()) { cloneFrame = currentFrame; qDebug()<<cloneFrame.map(QAbstractVideoBuffer::ReadWrite); const QImage img(cloneFrame.bits(), cloneFrame.width(), cloneFrame.height(), QVideoFrame::imageFormatFromPixelFormat(QVideoFrame::Format_Jpeg)); emit frameChanged(img); return true; } return false; }
seem incorrect for android, do you have any suggestion ?
-
Why are you mapping the frame in ReadWrite mode ? Read should be enough for your usage.
-