Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Qt 6.5 MediaPlayer and tcp stream
QtWS25 Last Chance

Qt 6.5 MediaPlayer and tcp stream

Scheduled Pinned Locked Moved Solved Qt 6
mediaplayerstreaming
6 Posts 3 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.
  • kbarniK Offline
    kbarniK Offline
    kbarni
    wrote on last edited by
    #1

    I'm trying to display a simple tcp stream in a MediaPlayer object in Qt 6.5 (ffmpeg backend), but it doesn't seem to work. I tried to open it from my application, as well from the mediaplayer example.

    Here is a minimal example: I create a stream myself using gstreamer (mjpeg encoding):

    gst-launch-1.0 videotestsrc ! videoconvert ! video/x-raw,format=I420 ! jpegenc quality=70 ! multipartmux ! tcpserversink host=127.0.0.1 port=5000
    

    I can open the stream using vlc (using url: tcp://127.0.0.1:5000) and using ffmpeg: ffplay tcp://127.0.0.1:5000. It can be decoded by gstreamer too: gst-launch-1.0 tcpclientsrc host=127.0.0.1 port=5000 ! multipartdemux ! jpegdec ! autovideosink

    However opening tcp://127.0.0.1:5000 as URL from the mediaplayer Qt example gives a "Could not open file" error.
    Same when setting the source property of a mediaplayer object to this URL.

    Can you give some hints how to open this stream? Or how can I build a stream that can be decoded by mediaplayer?

    JonBJ 1 Reply Last reply
    0
    • kbarniK kbarni

      I'm trying to display a simple tcp stream in a MediaPlayer object in Qt 6.5 (ffmpeg backend), but it doesn't seem to work. I tried to open it from my application, as well from the mediaplayer example.

      Here is a minimal example: I create a stream myself using gstreamer (mjpeg encoding):

      gst-launch-1.0 videotestsrc ! videoconvert ! video/x-raw,format=I420 ! jpegenc quality=70 ! multipartmux ! tcpserversink host=127.0.0.1 port=5000
      

      I can open the stream using vlc (using url: tcp://127.0.0.1:5000) and using ffmpeg: ffplay tcp://127.0.0.1:5000. It can be decoded by gstreamer too: gst-launch-1.0 tcpclientsrc host=127.0.0.1 port=5000 ! multipartdemux ! jpegdec ! autovideosink

      However opening tcp://127.0.0.1:5000 as URL from the mediaplayer Qt example gives a "Could not open file" error.
      Same when setting the source property of a mediaplayer object to this URL.

      Can you give some hints how to open this stream? Or how can I build a stream that can be decoded by mediaplayer?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @kbarni
      I don't know, but since Qt6 removed support for FTP protocol (QNetworkAccessManager) is this a non-starter trying to open a tcp:... Url schema whether for QMediaPlayer or otherwise?

      Oh dear, sorry, I thought it said ftp: not tcp: ! :(

      kbarniK 1 Reply Last reply
      0
      • JonBJ JonB

        @kbarni
        I don't know, but since Qt6 removed support for FTP protocol (QNetworkAccessManager) is this a non-starter trying to open a tcp:... Url schema whether for QMediaPlayer or otherwise?

        Oh dear, sorry, I thought it said ftp: not tcp: ! :(

        kbarniK Offline
        kbarniK Offline
        kbarni
        wrote on last edited by
        #3

        @JonB
        Normally TCP is the most low-level protocol (almost every other protocol sends data over TCP), so I don't know how this can be a problem. It definitely is supported by QTcpSocket.
        I tested without the tcp:// and it still doesn't work.
        Anyway, I was thinking that the URL was being sent directly to ffmpeg.

        Unfortunately the ffmpeg backend for Qt multimedia is not documented and QML is not very verbose when there's an error.

        JonBJ 1 Reply Last reply
        1
        • kbarniK kbarni

          @JonB
          Normally TCP is the most low-level protocol (almost every other protocol sends data over TCP), so I don't know how this can be a problem. It definitely is supported by QTcpSocket.
          I tested without the tcp:// and it still doesn't work.
          Anyway, I was thinking that the URL was being sent directly to ffmpeg.

          Unfortunately the ffmpeg backend for Qt multimedia is not documented and QML is not very verbose when there's an error.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @kbarni said in Qt 6.5 MediaPlayer and tcp stream:

          Normally TCP is the most low-level protocol

          I had a complete mind-mess! I thought (for some reason) you were asking about ftp: protocol, which has indeed been removed at Qt6, not the tcp you wrote and I quoted! Consequently ignore my previous!!

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

            Hi,

            Since you mention 6.5, it's likely related to QTBUG-111910.

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

            kbarniK 1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              Since you mention 6.5, it's likely related to QTBUG-111910.

              kbarniK Offline
              kbarniK Offline
              kbarni
              wrote on last edited by
              #6

              @SGaist Thank you! That should be probably it!
              I will test it on 6.5.1 when it will be released and report back.

              1 Reply Last reply
              0
              • kbarniK kbarni has marked this topic as solved on

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved