Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QML/Qt6 Mapping QVideoFrame from MediaPlayer on Android [OMX.MTK.VIDEO.DECODER.AVC]
Forum Updated to NodeBB v4.3 + New Features

QML/Qt6 Mapping QVideoFrame from MediaPlayer on Android [OMX.MTK.VIDEO.DECODER.AVC]

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 1 Posters 569 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.
  • K Offline
    K Offline
    Kai.
    wrote on last edited by
    #1

    I develop an app that needs to play video files. for that i use the qml type MediaPlayer.
    On C++ side i grab the videoframes and try to map them to system memory. this works on linux and for avi files on android but not for the native(?) video format on my android device.

    i use this code :

    void OpenGLVideoOutput::newFrame(const QVideoFrame &frame)
    {
        //qDebug() << frame << ", " << frame.handleType();
    
        QVideoFrame cloneFrame(frame);
        if(videoRenderer->ready() &&
            cloneFrame.isValid() &&
            cloneFrame.map(QVideoFrame::MapMode::ReadOnly))
        {
            currentFrame = cloneFrame.toImage();
            cloneFrame.unmap();
    
            cvFrame = cv::Mat(currentFrame.height(), currentFrame.width(), CV_8UC4, currentFrame.bits());
    
            videoRenderer->setItemSize(size());
            videoRenderer->setNewFrame(cvFrame);
            videoRenderer->show(showVideoPlane, showDistortionGrid,
                                showDistortionFieldIsoLines, showDistortionField);
        }
    }
    

    that produce the output :

    I OMXClient: IOmx service obtained
    D MediaCodec: flushMediametrics
    D SurfaceUtils: connecting to surface 0x746cf8f1d0, reason connectToSurface
    I MediaCodec: [OMX.MTK.VIDEO.DECODER.AVC] setting surface generation to 25123841
    D SurfaceUtils: disconnecting from surface 0x746cf8f1d0, reason connectToSurface(reconnect)
    D SurfaceUtils: connecting to surface 0x746cf8f1d0, reason connectToSurface(reconnect)
    D ACodec  : virtual setMtkParameters
    D SurfaceUtils: set up nativeWindow 0x746cf8f1d0 for 1920x1080, color 0x32315679, rotation 0, usage 0x402933
    W ACodec  : [OMX.MTK.VIDEO.DECODER.AVC] setting nBufferCountActual to 8 failed: -22
    D SurfaceUtils: set up nativeWindow 0x746cf8f1d0 for 1920x1088, color 0x32315679, rotation 0, usage 0x402933
    W ACodec  : [OMX.MTK.VIDEO.DECODER.AVC] setting nBufferCountActual to 12 failed: -22
    W libuntitled2_arm64-v8a.so: Error transferring the data to system memory: -38
    W libc    : Access denied finding property "ro.hardware.chipname"
    W libuntitled2_arm64-v8a.so: Error transferring the data to system memory: -38
    W libuntitled2_arm64-v8a.so: Invalid texture upload for 0x736cfc95f0 layer=0 mip=0
    W libuntitled2_arm64-v8a.so: Error transferring the data to system memory: -38
    

    receiving frames from integrated camera works as well.

    My question is how to load every video file into Mediaplayer Qml type, that is supported by my operating system ?

    thx :-)

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kai.
      wrote on last edited by
      #2

      An additional information is that the frames from mediaplayer differ from source to source and also for camera frames this is different.

      The specific problem seems to be mapping of Format_SamplerExternalOES, for every call to QVideoFrame::map i got : Error transferring the data to system memory: -38

      I have already checked if there is a active opengl context, it is.

      I have no idea :-( ...

      1 Reply Last reply
      0

      • Login

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