Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QVideoWidget not working with QVideoProbe
Forum Updated to NodeBB v4.3 + New Features

QVideoWidget not working with QVideoProbe

Scheduled Pinned Locked Moved Unsolved General and Desktop
qvideowidgetqvideoprobe
7 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JK3WN
    wrote on last edited by JK3WN
    #1

    So I tried out the example in https://doc.qt.io/qt-5/qvideoprobe.html.
    I set the video output to a QVideoWidget I created.
    For some reason, some videos do not show up and QVideoWidget stays as a black screen.
    If I delete the line "probe->setSource(player);", then it shows up again.
    I checked with different kind of videos, and I think mp4 videos that have a framerate of 30fps or more aren't showing up.
    Did anyone else have this problem? If so, how did you solve it?
    Yes, I did not make the slot processFrame(QVideoFrame), but I don't think that is the source of the problem.

    Qt Version 5.15.2
    MSVC2019 64bit
    Windows 10
    Using Windows Media Foundation

    mainwindow.cpp

    #include "mainwindow.h"
    #include "ui_mainwindow.h"

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

    QMediaPlayer *player = new QMediaPlayer();
    QVideoProbe *probe = new QVideoProbe;
    
    connect(probe, SIGNAL(videoFrameProbed(QVideoFrame)), this, SLOT(processFrame(QVideoFrame)));
    
    probe->setSource(player);
    
    player->setVideoOutput(ui->widget);
    player->setMedia(QUrl::fromLocalFile("C:/Users/user/Desktop/028.mp4"));
    player->play();
    

    }

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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What are you doing in your processFrame slot ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JK3WN
        wrote on last edited by
        #3

        Right now, processFrame(QVideoFrame) is empty.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Does it happen with all video files ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          J 1 Reply Last reply
          0
          • SGaistS SGaist

            Does it happen with all video files ?

            J Offline
            J Offline
            JK3WN
            wrote on last edited by JK3WN
            #5

            @SGaist No. It happens to only some of the files. Some files I could play with no problem, but some aren't. Most video files that had this problem had a framerate of 30. Video files with lower framerates had no problems. I don't think resolution is the problem, because I tried with small resolution videos with 30 fps and it still wasn't working.

            Edit: Tried the same example with my other computer, and it's working well. Both computers are Windows 10.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Different set of codecs ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              J 1 Reply Last reply
              0
              • SGaistS SGaist

                Different set of codecs ?

                J Offline
                J Offline
                JK3WN
                wrote on last edited by
                #7

                @SGaist No. Both computers have same codec set.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved