Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QML video gives Error: "No valid frames decoded before end of stream" some of the time

    QML and Qt Quick
    2
    2
    934
    Loading More Posts
    • 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.
    • M
      mkre last edited by

      Hello, I'm trying to get a QML media player + video output working. The media is played about nine out of ten times. But sometimes the media isn't loaded at all, and I have no reason why.

      Application output shows - Error: "No valid frames decoded before end of stream" - when the media isn't loaded. It seems like this might be a bug in GStreamer, but I haven't found much about how to work around it using QT.

      Here's my QML file

      import QtMultimedia 5.8
      import QtQuick 2.12
      import QtQuick.Window 2.12
      
      Item {
      
          height: Screen.height
          width: Screen.width
      
          MediaPlayer {
              autoLoad: true
              autoPlay: false
              id: player
          }
      
          VideoOutput {
              anchors.fill: parent
              id: videoOutput
              source: player
          }
      }
      

      And here is the code that is loading the media / telling the media player to play (I didn't include all the code, and its hobbled together from different files):

      // connections
          connect(stackedViews->getMediaPlayer(), SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(animationStateChanged(QMediaPlayer::State)));
          connect(stackedViews->getMediaPlayer(), SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));
      
      // slots 
      void BootDisplay::animationStateChanged(QMediaPlayer::State state)
      {
          if (state == QMediaPlayer::StoppedState)
          {
              qDebug() << "Boot animation finished!";
          }
      }
      
      void BootDisplay::mediaStatusChanged(QMediaPlayer::MediaStatus status)
      {
          if (status == QMediaPlayer::MediaStatus::LoadedMedia)
          {
              qDebug() << "Media loaded into player";
              stackedViews->getMediaPlayer()->play();
          }
      }
      
      // getMediaPlayer function
      QMediaPlayer* StackedViews::getMediaPlayer()
      {
          QMediaPlayer* obj = videoView->rootObject()->children()[0]->findChild<QMediaPlayer*>();
          if(obj) {
              return obj;
          }
          else {
              qDebug() << "Can't find the MediaPlayer!!!";
              return nullptr;
          }
      }
      
      1 Reply Last reply Reply Quote 0
      • C
        corleone31 last edited by

        Any luck on solving this problem?

        1 Reply Last reply Reply Quote 0
        • First post
          Last post