Qt World Summit: Register Today!

Codec returns RGB32 even though I list NV12 and other YUV formats first

  • Hi,

    I am on Windows 7 using K-Lite codec pack and a QAbstractVideoSurface (that I subclass) attached to a QMediaPlayer (also subclassed) through player::setVideoOutput.

    I return RGB32 formats as well as YUV formats (eg NV12, YUYV, YV12) in surface::supportedPixelFormats as shown below. It does not matter the order I return the formats; the codec always gives me RGB32 in surface::present(). This is a problem on less-capable machines...for example on one machine it takes almost a full second to do the decode! There might be something else wrong, but when I use a YUV format, the decode (and thus my playback) happens at the same rate as Windows Media Player.

    If I remove the RGB32 formats from the list then I do get YUV formats in ::present and higher performance, but then the duration and seek are broken for some videos! (QMediaPlayer::durationChanged never gets called for videos with metaDataAvailable = 0, even though they do work when I return/support RGB32 formats.)

    Any ideas? I have a support case filed as well.

    QAbstractVideoBuffer::HandleType handleType) const
    if (handleType == QAbstractVideoBuffer::NoHandle) {
    return QListQVideoFrame::PixelFormat()
    << QVideoFrame::Format_YV12
    << QVideoFrame::Format_NV12
    << QVideoFrame::Format_UYVY
    << QVideoFrame::Format_YUYV
    << QVideoFrame::Format_ARGB32
    << QVideoFrame::Format_BGRA32
    << QVideoFrame::Format_RGB32
    << QVideoFrame::Format_BGR32