Custom video in QVideoWidget
-
Hello,
Is there any example which shows how to draw custom video in the QVideoWidget?
The documentation here http://doc.qt.io/qt-5/videooverview.html provides examples on how to implement a class which receives video frames from QT Multimedia but not the other way around.Thanks,
Jaka -
Hi and welcome to devnet,
What do you mean by "the other way around" ?
-
Because you usually don’t draw on QVideoWidget. You create a custom media source were you generate the video frames you want to show.
Out of curiosity, what are you trying to achieve ?
-
Well you have to draw to some surface in any event, or you queue video frames to "something" and it draws them for you.
In any case the question remains... How do you do this?Looking at the source of QtMultimedia is not very enlightening since everything is a bit complex. But it seems that on Windows QMediaPlayer uses MediaFoundation's EVR or DirectShow's VMR with a custom presenter and that then somehow ends on the QVideoWidget.
What I want to achieve is to display video from a HD-SDI video board. The board has a custom cross-platform SDK and I wanted a cross-platform way of showing the video.
I know I can always use OpenGL or Direct3D or something like that to render the video, but that is not the point... -
Brings back memories...
Then implement a QCamera backend. It's not overly complicated and you'll be able to re-use it on all the needed platforms. This will also allow you to integrate nicely in your Qt applications whether it's widgets or QtQuick.
-
In any case this all goes back to the original question...
How do you do that?I glimpsed over DirectShow backend for QCamera and it is not much different than QMediaPlayer backend.
And I don't need camera controls.It would be nice to see a simple sample where you somehow obtain the QAbstractVideoSurface of the rendering target and just draw silly things, even random noise...
Documentation only states pretty obvious facts and even states that some things that I should do in order to accomplish what I want are out of the scope of the documentation
-
Hi! have a similar need, @JakaBac can solve this?
-
@DavidEmmanuel Hi and welcome to devnet,
The easiest is to look at the already existing backend. Which usually boils down to have one central class that does the various bits and create all the need control class that will you that central class to provide the various interface you want to support from the QCamera pipeline.