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. QMediaResource, getting any media info failed
Forum Updated to NodeBB v4.3 + New Features

QMediaResource, getting any media info failed

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.6k 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

    Hi! I'm trying to obtain media info from QMediaResource class methods.
    Please check this code.
    @
    QMediaResource mr(QUrl::fromLocalFile("test.avi"));
    QMediaContent mc(mr);

    QMediaPlayer player = new QMediaPlayer(this);
    QViedoWidget vw = new QVideoWidget;
    player->setVideoOutput(vw);
    player->setMedia(mc);
    vw->show();
    player->play();

    qDebug() << mr.resolution() << mr.videoCodec();@

    Video plays well. QMediaResource url returns right path to file.
    QMediaResource methods resolution(), videoCodec(), sampleRate() etc. returns 0 or empty values.
    Can anyone confirm this? Please run this simple example on your installation.
    Or I do something wrong?

    I'm using Qt5 on Windows7.

    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
      #2

      Your code looks ok to me.

      Try it on some other video types (for example, .mp4 and .mov files). Do they work? I've had some strange behaviour from Qt Multimedia on Windows, and often have trouble with .avi files... I believe the class is broken somewhere.

      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
        #3

        Thanks for your time. I checked on different kinds of containers and codecs (.avi, .mp4, .wmv and .mov). The same result - it seems to be bug. Let it be here for some more time and if nobody has positive result I will try report as bug.

        You have been involved in illegal use of magic.

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

          Reply from developers:
          "This class doesn't actually do anything at the moment... As a workaround, you can use QMediaPlayer::metadata() to get this information.
          Note that with Qt 5.0 and on Windows 7, even the metadata() function doesn't retrieve this information, it will be fixed in 5.0.1"

          "https://bugreports.qt-project.org/browse/QTBUG-28850":https://bugreports.qt-project.org/browse/QTBUG-28850

          You have been involved in illegal use of magic.

          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