Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. hardware video playback to multiple surfaces?
Qt 6.11 is out! See what's new in the release blog

hardware video playback to multiple surfaces?

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 2 Posters 1.4k 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.
  • davecotterD Offline
    davecotterD Offline
    davecotter
    wrote on last edited by davecotter
    #1

    say i'm using QMediaPlayer to playback video onto a single QAbstractVideoSurface.
    is that done in hardware? ie: the bits never have to be pushed back to the CPU?
    and then can i blit said surface to multiple widgets? in which case it STILL stays on the hardware?
    must i use an opengl widget as the destination surface?

    like i have two video windows (dedicated to video, which may be maximized full screen on a 4K monitor), and one "monitor" panel embedded in a larger GUI window with other controls in it. i want all three to display the same HD video at full framerate, and have text overlays too... can i do that without ever having the video bits come thru the CPU?

    1 Reply Last reply
    0
    • davecotterD Offline
      davecotterD Offline
      davecotter
      wrote on last edited by
      #6

      I've learned how to do it.

      • You have multiple QGraphicsView objects (maybe in different windows).
      • You can cause them to use OpenGL by calling setViewport() passing in a new QOpenGLWidget
      • Each of those has a QGraphicsScene
      • Each of those has a QGraphicsVideoItem element in the scene
      • Each of those has a QAbstractVideoSurface, fetched with videoSurface()
      • The QMediaPlayer can set it's output to go to ALL of the video surfaces at once, by passing a vector of them to its setVideoOutput()

      Does that make sense?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        AFAIK, it will depend on several factors like the OS, the backend used and whether you are using widgets or QtQuick.

        You can customize some parts however the first thing to establish is what is your target platform.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • davecotterD Offline
          davecotterD Offline
          davecotter
          wrote on last edited by
          #3

          macOS and Windows, using Widgets

          1 Reply Last reply
          0
          • davecotterD Offline
            davecotterD Offline
            davecotter
            wrote on last edited by
            #4

            Does anybody know the answer to this?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #5

              I remember that Qt Quick video elements use OpenGL for rendering but AFAIR, it was not the case by default for widgets. So that is something you'll have to test.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • davecotterD Offline
                davecotterD Offline
                davecotter
                wrote on last edited by
                #6

                I've learned how to do it.

                • You have multiple QGraphicsView objects (maybe in different windows).
                • You can cause them to use OpenGL by calling setViewport() passing in a new QOpenGLWidget
                • Each of those has a QGraphicsScene
                • Each of those has a QGraphicsVideoItem element in the scene
                • Each of those has a QAbstractVideoSurface, fetched with videoSurface()
                • The QMediaPlayer can set it's output to go to ALL of the video surfaces at once, by passing a vector of them to its setVideoOutput()

                Does that make sense?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  Sounds correct

                  One thing that comes to mind, if you are showing the same video feed, why not have only one scene and several views on it ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • davecotterD Offline
                    davecotterD Offline
                    davecotter
                    wrote on last edited by
                    #8

                    because one view may (or may not) have the overlaid text, and another may not even be showing the video, may be showing a "who's up next" screen, depending on user-prefs

                    it's configurable to show the exact same thing on all screens, but ALSO configurable to show different things on different screens.

                    -dave

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      I do not know the interaction that you may have a need for with the other components but you can likely do everything in one scene and then just move the "focus point" of the view in the right place of that big scene.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      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