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. Qt5 with QMediaPlayer and QVideoWidget
Forum Updated to NodeBB v4.3 + New Features

Qt5 with QMediaPlayer and QVideoWidget

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 24.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.
  • I Offline
    I Offline
    INeedMySpace
    wrote on last edited by
    #1

    Hello friends.
    I`m using Windows 7 with "Qt5.0.0-beta2 binary install":http://releases.qt-project.org/qt5.0/beta2/qt-windows-opensource-5.0.0-beta2-msvc2010_32-x86-offline.exe.
    I run simplified example of player (from examples) using QMediaPlayer and QVideoWidget. For most of the files I'm trying to play I got errors like "handleSessionEvent: serious error = -1072875852" or "handleSessionEvent: serious error = -2147467262" or no errors but without visual result. I used 4 files for testing. Two - avi with mpeg4 inside, one - mp4 with mpeg4 and one mpg with mpeg1 inside.
    Only one avi file is played by code but they all are played well with Windows Media Player and Media Player Classic.
    And I can't get any metadata from media - player->availableMetaData() returns empty list.
    I have several questions:

    • Is QMultimedia part of Qt5 ready for "real use"? (I run examples from qmultimedia on my different video files and they almost all behave with the same result)
    • What codecs are used by QMediaPlayer?
    • How can I get info from video file?
    • What is the best practice to open and parse video files in Qt?
    • What "backends" are used in case QVideoWidget and in QMultimedia totally? (OpenGL, DirectShow or what?) I'm running on Windows 7.
    • Is there posibility to switch "backends"? I want to use OpenGL and shaders to accelerate video output.

    The code itself:
    @#include <QDebug>
    #include <QApplication>
    #include <QMediaPlayer>
    #include <QVideoWidget>
    #include <QVBoxLayout>
    #include <QFile>

    int main(int argc, char** argv)
    {
    QApplication app(argc, argv);

    QWidget *widget = new QWidget;
    widget->resize(400, 300);
    
    QVBoxLayout *layout = new QVBoxLayout;
    QMediaPlayer* player = new QMediaPlayer;
    QVideoWidget* vw = new QVideoWidget;
    
    layout->addWidget(vw);
    widget->setLayout(layout);
    
    player->setVideoOutput(vw);
    QFile file&#40;"test1.avi"&#41;;
    if(!file.open(QIODevice::ReadOnly))
        qDebug() << "Could not open file";
    player->setMedia(QUrl::fromLocalFile&#40;"test1.avi"&#41;);
    player->play();
    widget->show();
    qDebug() << player->availableMetaData() << player->currentMedia().canonicalUrl();
    return app.exec();
    

    }@

    You have been involved in illegal use of magic.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      INeedMySpace
      wrote on last edited by
      #2

      May be someone can share info about QMultimedia internals? I don't believe what only trustworthy info about internals we have are sources :)

      You have been involved in illegal use of magic.

      1 Reply Last reply
      0
      • I Offline
        I Offline
        INeedMySpace
        wrote on last edited by
        #3

        For one question I've found information.
        QMultimedia uses plugins from plugins/mediaservice folder. And to play video on Windows platform it uses Windows Media Foundation library.

        You have been involved in illegal use of magic.

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          Thank you for sharing your findings on the forums.

          Were you able to get the example running?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • I Offline
            I Offline
            INeedMySpace
            wrote on last edited by
            #5

            I run pre-compiled examples from binary distribution and made my own test basing on the logic behind. They works only on some (small amount of) videos. I really can't figure out the difference (except resolution) between two avi files with MPEG4 (H264) (one video stream and no audio streams in both) and one is played and other is not. And also I can't even get meta from files and in some cases there is no error messages at all on bad attempt.
            And additionally in sources there are some more plugins (mostly for Linux) with direct show plugin. And it is not included in binary distribution.
            For my own development I fall back to FFmpeg lib wrapper, cause I don't have time for now to investigate why the examples don't reliably work.

            You have been involved in illegal use of magic.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              karlox
              wrote on last edited by
              #6

              I wondering why no one qt master quote in this thread. The questions arises by INeedMySpace are a sign of leak of information on multimedia documentation. I have the same problems but no clear documentations. So i think to use ffmpeg, but i would appreciate some answers on why qt multimedia is not quite documented and we doesn't know how backend work on different platform.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                karlox
                wrote on last edited by
                #7

                [quote author="INeedMySpace" date="1353418796"]I run pre-compiled examples from binary distribution and made my own test basing on the logic behind. They works only on some (small amount of) videos. I really can't figure out the difference (except resolution) between two avi files with MPEG4 (H264) (one video stream and no audio streams in both) and one is played and other is not. And also I can't even get meta from files and in some cases there is no error messages at all on bad attempt.
                And additionally in sources there are some more plugins (mostly for Linux) with direct show plugin. And it is not included in binary distribution.
                For my own development I fall back to FFmpeg lib wrapper, cause I don't have time for now to investigate why the examples don't reliably work.[/quote]

                Can you share with us this lib?

                1 Reply Last reply
                0
                • I Offline
                  I Offline
                  INeedMySpace
                  wrote on last edited by
                  #8

                  At this moment my Qt video player wrapper for ffmpeg is working but little bit ugly and should be improved. I could share it but need some time to organize public svn. Fill free to ask any questions here or drop me a mail - onesteptospace at google mail.

                  You have been involved in illegal use of magic.

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    karlox
                    wrote on last edited by
                    #9

                    i have found another lib that wrap ffmpeg https://github.com/wang-bin/QtAV it seem to work fine. Maybe we can avoid to reinvent the wheel ;).

                    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