Qt World Summit: Register Today!

QVideoFrame::map() is false in android

  • 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 28

    This 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

  • Lifetime Qt Champion


    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 &currentFrame)
        if (currentFrame.isValid()) {
            cloneFrame = currentFrame;
            const QImage img(cloneFrame.bits(),
             emit frameChanged(img);
            return true;
        return false;

    seem incorrect for android, do you have any suggestion ?

  • Lifetime Qt Champion

    Why are you mapping the frame in ReadWrite mode ? Read should be enough for your usage.

Log in to reply