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. How to render a video frame using QVideoFrame class

How to render a video frame using QVideoFrame class

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.6k Views 1 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.
  • C Offline
    C Offline
    Chakravarthi
    wrote on last edited by
    #1

    Dear All,

    I'm new to Qt application and I will get a video frame from V4L2 API VIDIOC_DQBUF. I want to render video frame which is received from VIDIOC_DQBUF in qt using QVideoFrame. V4L2 driver will get video frame from FPGA device, so it is a raw video without any header and encoding. Device support UYVY,NV12,RGBA,RGB24, NV21 and some other color formats. So QVideoFrame also supports these formats.

    Queries:

    1. Kindly give me snippet code by which I can render a video in qt using QVideoFrame.
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      How will you be getting these frames from V4L ?

      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
      • C Offline
        C Offline
        Chakravarthi
        wrote on last edited by
        #3

        Hi,

        In linux V4L2 is framework for video. I have mentioned before I'm using VIDIOC_DQBUF API from this I will get video frame . VIDIOC_DQBUF API will call V4L2 driver.

        Regards,

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Chakravarthi
          wrote on last edited by
          #4

          Hi All,

          Please let me know how to use this function.
          QVideoFrame::QVideoFrame(QAbstractVideoBuffer *buffer, const QSize &size, QVideoFrame::PixelFormat format) .

          I will get video frame by using following API.

          if (ioctl(camera->fd, VIDIOC_DQBUF, &buf) == -1)
          {
          qDebug()<<"VIDIOC_DQBUF failed";
          return 0;
          }
          memcpy(camera->head.start, camera->buffers[buf.index].start, buf.bytesused);

          After memcpy, camera->head.start will have valid video frame from the driver. How can use this "camera->head.start" to construct video frame using QVideoFrame and then how to render it using Qpaint/Qlabel. (camera->head.start is of type uint8_t* ).

          How I can user map(), bits() and mappedBytes() function so that, I can get video frame constructed for given video data. ?

          How I can user paint/label to render video ?

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

            In the absolute, I would rather build a custom QCamera plugin so I can use the QCameraViewfinder to display the data automatically and all the QtMultimedia machinery to handle starting and stopping the camera.

            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