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. How to create a QVideoFrame with custom data buffer?

How to create a QVideoFrame with custom data buffer?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 4 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.
  • D Offline
    D Offline
    Dylan Deng
    wrote on last edited by Dylan Deng
    #1

    Hi there. I'm making an application to show a video data with Qt Quick (VideoOutput), I have already created an object based on QObject and provided videoSurface property.

    Q_PROPERTY(QAbstractVideoSurface *videoSurface READ videoSurface WRITE setVideoSurface)
    

    But I don't konw how to create a QVideoFrame with my custom data buffer to send to QAbstractVideoSurface present() function. My custom video data buffer format is YUV420p, and I have the data length/width/height, so please help me, thanks.

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

      Hi,

      From the top of my head:

      • use the second constructor to create a QVideoFrame of the right size and format
      • map the QVideoFrame
      • memcpy the content of your buffer over there
      • unmap the QVideoFrame

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

      D 1 Reply Last reply
      0
      • D Offline
        D Offline
        Dylan Deng
        wrote on last edited by Dylan Deng
        #3

        Thanks for your help, I will try it.

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          From the top of my head:

          • use the second constructor to create a QVideoFrame of the right size and format
          • map the QVideoFrame
          • memcpy the content of your buffer over there
          • unmap the QVideoFrame
          D Offline
          D Offline
          Dylan Deng
          wrote on last edited by
          #4

          @SGaist I have solved this problem and thanks for your help again.

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

            Great ! Did you use the technique I suggested ?

            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
            • T Offline
              T Offline
              tommytrojan
              wrote on last edited by
              #6

              I know this thread is old, but does the constructor mentioned above no longer exist in Qt 6?

              SGaistS malikcisM 2 Replies Last reply
              0
              • T tommytrojan

                I know this thread is old, but does the constructor mentioned above no longer exist in Qt 6?

                SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @tommytrojan hi, based on the class documentation, I would say no.

                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
                • T tommytrojan

                  I know this thread is old, but does the constructor mentioned above no longer exist in Qt 6?

                  malikcisM Offline
                  malikcisM Offline
                  malikcis
                  wrote on last edited by
                  #8

                  @tommytrojan Hi Tommy,
                  Did you manage to solve the problem in QT6?
                  Curious how you did it.
                  thx

                  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