Important: Please read the Qt Code of Conduct -

Inverted Qimage when implementing QAbstractVideoSurface on windows

  • Re: [Video on StreamingVideoSurface is inverted](or not depending on whose PC runs it)

    present(const QVideoFrame &frame) is giving inverted images on Windows. I know the that DirectShow with Qt has limitation on windows, not quite sure if this is because of that or something to do with my implementation.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Where does your image data come from ?

  • Thank you. I have read lot of other answers by you, many thanks for the quick revert. I am taking default system camera(QCamera(QCameraInfo::defaultCamera())) and setting QAbstractVideoSurface as viewfinder to it and in present(const QVideoFrame &frame) I am creating the Qimage from the QVideoFrame.

    QVideoFrame cloneFrame(frame);;
    const QImage image(cloneFrame.bits(),

  • Lifetime Qt Champion

    By inverted do you mean horizontal or vertically flipped ?

  • Image is upside down, attaching a reference image.![0_1553754454041_Capture.PNG](Uploading 100%)

    Image link on Imgur

  • Lifetime Qt Champion

    Then you can use QImage::mirrored to put it in the right direction.

  • Hmm, not sure if that is the right thing to do. Same code on Linux shows image frames in proper orientation. On Windows I tried with 3 different camera hardwares, on 2 cameras image frame was flipped whereas on third one image was mirrored(like how a image looks infront of mirror). I think the issue is related to multimedia/directshow implementation. It seems generic fix for this is to fix in qtmultimedia.

  • @vkini

    I don't think it's a problem of the Qt module.

    Maybe Windows and Linux us a different coordinate systems for the Camera, Video or Image.

    Or in the OS the Camera is preset with a mirrored option.

  • @beecksche Probably you are right. And for me issue solves with marking it mirrored. The best thing for now would be to mark it mirrored on windows and keeping it same for Linux. Thank you @SGaist & @beecksche .

Log in to reply