Solved How to create a QVideoFrame with custom data buffer?
-
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. -
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
-
Thanks for your help, I will try it.
-
@SGaist I have solved this problem and thanks for your help again.
-
Great ! Did you use the technique I suggested ?
-
I know this thread is old, but does the constructor mentioned above no longer exist in Qt 6?
-
@tommytrojan hi, based on the class documentation, I would say no.
-
@tommytrojan Hi Tommy,
Did you manage to solve the problem in QT6?
Curious how you did it.
thx