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


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What do you mean by "the other way around" ?



  • There is an example how to get video frames from let's say a QMediaPlayer.
    But there is no example how to draw into a QVideoWidget


  • Lifetime Qt Champion

    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...


  • Lifetime Qt Champion

    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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.