Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML optimal way to stream/update images (Qt 5)
Forum Updated to NodeBB v4.3 + New Features

QML optimal way to stream/update images (Qt 5)

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 2.3k Views 2 Watching
  • 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.
  • B Offline
    B Offline
    Black Star
    wrote on last edited by
    #1

    First, a little background: I'm trying to display image data streamed from a medical device in real time. The approach I am currently testing is to define a QML Image element with a custom source (e.g. "image://device/0") and use a custom QQuickImageProvider::requestPixmap() to feed the Image element with fresh data from the device.

    The problem is that the Image flickers whenever I update its contents, i.e. it disappears for a moment before it reappears with the fresh data.

    Is there a way to enable some form of double-buffering to avoid this ugly flicker?

    Alternatively, is there a more efficient way to go about implementing this? I would imagine that I might be able to use something like a Video element with a custom source that feeds it new frames as necessary. Unfortunately, I haven't been able to find anything relevant in the documentation.

    I'd be grateful if someone could point me to the right direction!

    1 Reply Last reply
    0
    • T Offline
      T Offline
      TomTomTom
      wrote on last edited by
      #2

      Did you find a solution?

      GrecKoG 1 Reply Last reply
      0
      • T TomTomTom

        Did you find a solution?

        GrecKoG Offline
        GrecKoG Offline
        GrecKo
        Qt Champions 2018
        wrote on last edited by
        #3

        @TomTomTom The way to do this is not to use QQuickImageProvider and Image

        Instead use VideoOutput with a source set as a QObject based class with a writable videoSurface property that can accept a QAbstractVideoSurface based class and can follow the correct protocol to deliver QVideoFrames to it.

        That means that Qt will call your videoSurface setter with a QAbstractVideoSurface already constructed (you don't have to create it, you just do stuff on the one passed to you). You then need to call start on it with the QVideoSurfaceFormat of your choice (the one of the frames you will provide to it), and then just periodically call present on it with a QVideoFrame you generated.

        The only technical point here is to generate the QVideoFrame, and maybe decipher the doc ;).

        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