Important: Please read the Qt Code of Conduct -

omxplayer doesn't exit when the video finish

  • Rasbian Lite, Qt5.9.2. I launch omxplayer in this way:

    QProcess *_omx = new QProcess(this);
    connect(_omx, &QProcess::started, this, &QPlayer::omx_started);
    connect(_omx, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(omx_finished(int,QProcess::ExitStatus)));
    connect(_omx, &QProcess::readyRead, this, &QPlayer::omx_readyRead);
    void QPlayer::play(QString uri)
        if (uri.isEmpty()) _uri = uri;
        if (!QFile::exists(uri)) return;
        QStringList args;
        args << "-o" << "0" << "-i" << "0";
        args << "omxplayer";
        args << "-I" << "-s";
        args << "-o" << "hdmi" << _uri;
        _omx->start("stdbuf", args, QProcess::Unbuffered | QProcess::ReadWrite);

    It happens that when the video finishes omxplayer is still alive for about 10+ seconds. After that time it exits and the finished signal is emitted by QProcess. Launching the very same command from console leads to the expected behavior (i.e. omxplayer exits immediately after the video has finished).

    Do you see something wrong here?

Log in to reply