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. How to use appsrc with streams properly

How to use appsrc with streams properly

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.2k Views 2 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.
  • H Offline
    H Offline
    huseyinkozan
    wrote on last edited by huseyinkozan
    #1

    Hi,

    I have a MPEG-TS stream that comes over either UART, ort eth, and I want to play it with QMediaPlayer. I am reading at a separate thread and have created a QLocalSever and writing stream to clients.

    At constructor:

        m_mediaPlayer = new QMediaPlayer(this, QMediaPlayer::StreamPlayback);
        m_mediaPlayer->setVideoOutput(ui->videoWidget);
    

    After connecting a client with QLocalSocket:

        QString pipeline = QString("gst-pipeline: appsrc is-live=true format=time ! "
                                   "tsdemux ! h264parse ! avdec_h264 ! videoconvert ! "
                                   "xvimagesink name=\"qtvideosink\"");
        m_mediaPlayer->setMedia(QUrl(pipeline), &m_localSocket);
        m_mediaPlayer->play();
    

    Status changes to BufferedMedia but no videoAvailableChanged() or bufferStatusChanged() signals are triggered:

    void MainWindow::mediaStatusChanged(QMediaPlayer::MediaStatus) "" 2
    void MainWindow::mediaStateChanged(QMediaPlayer::State) "" 1
    void MainWindow::mediaStatusChanged(QMediaPlayer::MediaStatus) "" 6 
    

    Is this approach the right way ?
    How can we use appsrc to play stream ?

    Edit: Qt version: 5.12.6, OS: Ubuntu

    1 Reply Last reply
    0
    • H Offline
      H Offline
      huseyinkozan
      wrote on last edited by
      #2

      Forget to mention, I tried sending over UDP and grabing with a udpsrc pipeline like at the docs and it worked. But I dont want to carry over UDP and lost packages.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        huseyinkozan
        wrote on last edited by
        #3

        At windows, both udpsrc and appsrc didnt work. Gives this error:

        DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x800c000d ()
        

        The docs says:

        The Qt Multimedia APIs build upon the multimedia framework of the underlying platform. This can mean that support for various codecs or containers can vary between machines, depending on what the end user has installed.

        Is this mean we cannot use full featured gst-pipeline on all platforms ?

        SGaistS 1 Reply Last reply
        0
        • H huseyinkozan

          At windows, both udpsrc and appsrc didnt work. Gives this error:

          DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x800c000d ()
          

          The docs says:

          The Qt Multimedia APIs build upon the multimedia framework of the underlying platform. This can mean that support for various codecs or containers can vary between machines, depending on what the end user has installed.

          Is this mean we cannot use full featured gst-pipeline on all platforms ?

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          GStreamer is the Linux backend. If you want to use it on other platforms, you'll have to compile the backend yourself.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          H 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            GStreamer is the Linux backend. If you want to use it on other platforms, you'll have to compile the backend yourself.

            H Offline
            H Offline
            huseyinkozan
            wrote on last edited by
            #5

            @SGaist Thanks for the reply.

            I checked the docs, and it shows GStreamer backend is only for Unix:
            https://wiki.qt.io/Qt_5.13_Multimedia_Backends

            And only two windows specific backends listed here:
            https://doc.qt.io/qt-5/qtmultimedia-windows.html

            If I build GStreamer and its plugins and GStreamer plugin, can I use it as shown QMediaPlayer::setMedia() example ?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              I haven't tried it yet on Windows, but AFAIK, it should work like that.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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