Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QVideoWidget and QMedia Player - Problem with showing video (Screen stays blank)



  • Using Qt5 and Running under Kubntu in Oracle VM Ware.

    Hello,

    I am trying to run and show a video in a simple example for further use.
    Have tried both showing it in QGraphics view and latest to make is simple trying to add that in Horizontal layout.

    The code runs and applicaiton output is as below:
    @
    " libGL error: pci id for fd 9: 80ee:beef, driver (null)
    libGL error: core dri or dri2 extension not found
    libGL error: failed to load driver: vboxvideo
    QMediaPlayer::PlayingState
    "
    @

    It doesn't run a video. Screen stays black/blank.

    CAN ANYONE FIGURE OUT WHAT COULD BE WRONG HERE. WHY IT IS NOT SHOWING VIDEO.
    AND ANY SUGGESTION ON TRYING OTHER SOLUTIONS WOULD BE WELCOME>

    My code is as below:

    @@@@
    #include "application.h"
    #include "ui_application.h"

    #include <QtMultimedia/QMediaPlayer>
    #include <QtMultimediaWidgets/QVideoWidget>

    #include <QDebug>

    Application::Application(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Application)
    {
    ui->setupUi(this);

    // ADD USER CODE HERE
    
    QMediaPlayer* player = new QMediaPlayer;
    QVideoWidget* vw = new QVideoWidget;
    
    ui->horizontalLayout->addWidget(vw);
    
    
    player->setVideoOutput(vw);
    player->setMedia(QUrl::fromLocalFile("/home/ccs/qt/MyProjects/VideoPlayTest/Multimedia/Shaktimanmpgvideo.mpg"));
    
    
    vw->setGeometry(0,0,800,480);
    vw->show();
    
    
    player->play();
    
    qDebug() << player->state();
    

    }

    Application::~Application()
    {
    delete ui;
    }

    @@@@

    Output Screen looks like image attached:

    0_1534950947596_Output.jpg


  • Lifetime Qt Champion

    Hi,

    VM Ware or Virtual Box ?

    If the later, did you install the Guest Additions on the machine ?
    Can you run something like glxgears successfully ?
    Did you enabled 3D acceleration ?

    @hrathod said in QVideoWidget and QMedia Player - Problem with showing video (Screen stays blank):

    CAN ANYONE FIGURE OUT WHAT COULD BE WRONG HERE. WHY IT IS NOT SHOWING VIDEO.
    AND ANY SUGGESTION ON TRYING OTHER SOLUTIONS WOULD BE WELCOME>

    Please refrain from writing such all caps sentences. In written language it's considered shouting and rude.



  • Hello SGaist,

    Thank you first of all for the reply and suggestions.

    It is Oracle VM Virtual Box Manager.
    3D Acceleration was not enabled. Now enabled.
    And yes there is a guest addition installed. Adding two pictures for reference.

    Wasn't knowing about all Caps things. It was just an attempt to separate a request from the code and description. Will keep in mind for future use.

    After enabling 3d acceleration, did try again running below code. Still it is blank, but now there are some list of warnings which are pasted after the code.

    @@@
    #include "application.h"
    #include "ui_application.h"

    #include <QtMultimedia/QMediaPlayer>
    #include <QtMultimediaWidgets/QVideoWidget>

    #include <QDebug>

    Application::Application(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Application)
    {
    ui->setupUi(this);

    // ADD USER CODE HERE
    
    QMediaPlayer* player = new QMediaPlayer;
    QVideoWidget* vw = new QVideoWidget;
    
    player->setVideoOutput(vw);
    player->setMedia(QUrl::fromLocalFile("/home/ccs/qt/MyProjects/VideoPlayTest/Multimedia/Shaktimanmpgvideo.mpg"));
    
    
    vw->setGeometry(0,0,800,480);
    vw->show();
    
    
    player->play();
    
    qDebug() << player->state();
    

    }

    Application::~Application()
    {
    delete ui;
    }

    @@@

    // Application output as below
    Starting /home/ccs/qt/MyProjects/build-VideoPlayTest-Virtual_Development_Qt5-Debug/VideoPlayTest...
    libGL error: pci id for fd 9: 80ee:beef, driver (null)
    OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table
    OpenGL Warning: glVertexArrayRangeNV not found in mesa table
    OpenGL Warning: glCombinerInputNV not found in mesa table
    OpenGL Warning: glCombinerOutputNV not found in mesa table
    OpenGL Warning: glCombinerParameterfNV not found in mesa table
    OpenGL Warning: glCombinerParameterfvNV not found in mesa table
    OpenGL Warning: glCombinerParameteriNV not found in mesa table
    OpenGL Warning: glCombinerParameterivNV not found in mesa table
    OpenGL Warning: glFinalCombinerInputNV not found in mesa table
    OpenGL Warning: glGetCombinerInputParameterfvNV not found in mesa table
    OpenGL Warning: glGetCombinerInputParameterivNV not found in mesa table
    OpenGL Warning: glGetCombinerOutputParameterfvNV not found in mesa table
    OpenGL Warning: glGetCombinerOutputParameterivNV not found in mesa table
    OpenGL Warning: glGetFinalCombinerInputParameterfvNV not found in mesa table
    OpenGL Warning: glGetFinalCombinerInputParameterivNV not found in mesa table
    OpenGL Warning: glDeleteFencesNV not found in mesa table
    OpenGL Warning: glFinishFenceNV not found in mesa table
    OpenGL Warning: glGenFencesNV not found in mesa table
    OpenGL Warning: glGetFenceivNV not found in mesa table
    OpenGL Warning: glIsFenceNV not found in mesa table
    OpenGL Warning: glSetFenceNV not found in mesa table
    OpenGL Warning: glTestFenceNV not found in mesa table
    libGL error: core dri or dri2 extension not found
    libGL error: failed to load driver: vboxvideo
    OpenGL Warning: XGetVisualInfo returned 0 visuals for 09612668
    OpenGL Warning: Retry with 0x8002 returned 0 visuals
    OpenGL Warning: XGetVisualInfo returned 0 visuals for 09612668
    OpenGL Warning: Retry with 0x8002 returned 0 visuals
    OpenGL Warning: glXGetFBConfigAttrib for 09612668, failed to get XVisualInfo
    OpenGL Warning: XGetVisualInfo returned 0 visuals for 09612668
    OpenGL Warning: Retry with 0x8002 returned 0 visuals
    OpenGL Warning: glXGetFBConfigAttrib for 09612668, failed to get XVisualInfo
    OpenGL Warning: XGetVisualInfo returned 0 visuals for 09612668
    OpenGL Warning: Retry with 0x8002 returned 0 visuals
    OpenGL Warning: glXGetFBConfigAttrib for 09612668, failed to get XVisualInfo
    OpenGL Warning: XGetVisualInfo returned 0 visuals for 09612668
    OpenGL Warning: Retry with 0x8002 returned 0 visuals
    OpenGL Warning: glXGetFBConfigAttrib for 09612668, failed to get XVisualInfo
    OpenGL Warning: XGetVisualInfo returned 0 visuals for 09612668
    OpenGL Warning: Retry with 0x8002 returned 0 visuals
    OpenGL Warning: glXGetFBConfigAttrib for 09612668, failed to get XVisualInfo
    OpenGL Warning: XGetVisualInfo returned 0 visuals for 09612668
    OpenGL Warning: Retry with 0x8002 returned 0 visuals
    OpenGL Warning: glXGetFBConfigAttrib for 09612668, failed to get XVisualInfo
    OpenGL Warning: XGetVisualInfo returned 0 visuals for 09612668
    OpenGL Warning: Retry with 0x8002 returned 0 visuals
    OpenGL Warning: glXGetFBConfigAttrib for 09612668, failed to get XVisualInfo
    OpenGL Warning: XGetVisualInfo returned 0 visuals for 09612668
    OpenGL Warning: Retry with 0x8002 returned 0 visuals
    OpenGL Warning: glXGetFBConfigAttrib for 09612668, failed to get XVisualInfo
    QMediaPlayer::PlayingState

    1_1534998554534_Guest Addition.jpg 0_1534998554534_3D Accn.jpg


  • Qt Champions 2019

    @hrathod Can you play same video with a player like VLC?



  • @jsulm
    Yes, I am able to play video in VLC in windows and also in Linux.


  • Lifetime Qt Champion

    Can you try one of Qt's OpenGL example ?

    By the way, to include code you can use three backticks before and after the code or the </> button to start adding code.



  • @SGaist
    Hello,

    Yes even tried OpenGL example.

    I guess there are some drivers problem or missing supporting set up.
    Unable to figure that out still. Tried installing and updating some drivers.

    However, for now have done this with an alternative by converting video to GIF and running GIF in label.

    Thanks for your time on supporting this.

    **
    By the way, to include code you can use three backticks before and after the code or the </> button to start adding code.

    Noted. For next posts will keep this in mind.

    Hardik Rathod


  • Lifetime Qt Champion

    Which version of VirtualBox are you using ?


Log in to reply