Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML video gives Error: "No valid frames decoded before end of stream" some of the time

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.2k Views
  • 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 Offline
    M Offline
    mkre
    wrote on last edited by
    #1

    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
    0
    • C Offline
      C Offline
      corleone31
      wrote on last edited by
      #2

      Any luck on solving this problem?

      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