How to render a video frame using QVideoFrame class
-
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:
- Kindly give me snippet code by which I can render a video in qt using QVideoFrame.
-
Hi,
How will you be getting these frames from V4L ?
-
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,
-
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 ?
-
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.