[Interest] QVideoProbe video frames upside down

Tomasz Wcislo wtom95 at gmail.com
Tue Jul 17 16:58:25 CEST 2018


Hello everyone,

I'm working on a video conferencing app, and I have trouble converting
QVideoFrames to QImages.
I get the frames from a QVideoProbe attached to a QCamera, and I display
them in a QLabel using this code:

    QVideoFrame vf(frame);

    vf.map(QAbstractVideoBuffer::ReadOnly);

    m_lastFrame = QImage(vf.bits(), vf.width(), vf.height(),
QVideoFrame::imageFormatFromPixelFormat(vf.pixelFormat()));

    vf.unmap();


    m_label->setPixmap(QPixmap::fromImage(m_lastFrame);


The problem is the following: the frames are upside down and I have to
apply a QTransformation to flip them:


    m_label->setPixmap(QPixmap::fromImage(m_lastFrame).transformed(QTransform().rotate(180));


Why are they upside down? Will it be the case on each computer? (as
the frames will be displayed on different computers, I don't want them
to be flipped incorrectly on certain devices).


Any help would be greatly appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180717/d1e1394b/attachment.html>


More information about the Interest mailing list