Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QMediaPlayer connected to QAbstractVideoSurface returns QVideoFrame::Format_NV12, but the data seems to be 8-bit per pixel instead of 12-bit per pixel



  • I was having trouble using QMediaPlayer with video output connected to a QAbstractVideoSurface with format QVideoFrame::Format_BGRA32, QVideoFrame::Format_BGR32 or other combos like that (present not called reliably or called slowly if at all.)

    But with QVideoFrame::Format_NV12, QAbstractVideoSurface::present gets called reliably and decoding seems to happen at the right rate. But the data is only 8-bit (e.g. with a video frame width = 1920, height = 1080 the frame returned in QAbstractVideoSurface::present only seems to have 1920 x 1080 bytes (8-bits per pixel) whereas I expect it should have 12-bits per pixel because it's NV12.

    Using the 8-bit data does work to give the luminance (Y) correctly. But where is my color data (U, V)?



  • Ah, I see that QVideoFrame::planeCount() returns 2 when the frame is mapped. That is where the data is.


Log in to reply