Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QVideoFrame::map() is false in android

QVideoFrame::map() is false in android

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 631 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RyuShai
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      How are you mapping your video frame ?

      Note that on Android, IIRC; you get an OpenGL texture.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        RyuShai
        wrote on last edited by
        #3

        here how i convert QVideoFrame to QImage to display

        bool AndroidFrame::present(const QVideoFrame &currentFrame)
        {
            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 ?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • KailoKyraK KailoKyra referenced this topic on

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved