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. Streaming and showing video using a QVideoWidget object + FFmpeg
Forum Updated to NodeBB v4.3 + New Features

Streaming and showing video using a QVideoWidget object + FFmpeg

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 2.3k Views 1 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.
  • X Offline
    X Offline
    Ximenes
    wrote on 4 May 2023, 20:30 last edited by
    #1

    Hello,

    I'm using QT 6.5 to receive and stream a video, using UDP. This version of QT uses Ffmpeg as default multimedia backend, so I started using QProcess to connect with the server and the 'ffplay' command to present the image. However, I need to embed the video in my application, not just open another screen. Similar to setting my output to a QVideoWidget.

    I already tried some options, like setting like this

     QMediaPlayer* player->setSource(QUrl("udp://127.0.0.1:5000"));
     mediaPlayer->setVideoOutput(ui->widget_Video);
    

    but the screen is still black.
    Does anyone know how to do that or have any suggestions?

    J 1 Reply Last reply 4 May 2023, 20:33
    0
    • X Ximenes
      4 May 2023, 20:30

      Hello,

      I'm using QT 6.5 to receive and stream a video, using UDP. This version of QT uses Ffmpeg as default multimedia backend, so I started using QProcess to connect with the server and the 'ffplay' command to present the image. However, I need to embed the video in my application, not just open another screen. Similar to setting my output to a QVideoWidget.

      I already tried some options, like setting like this

       QMediaPlayer* player->setSource(QUrl("udp://127.0.0.1:5000"));
       mediaPlayer->setVideoOutput(ui->widget_Video);
      

      but the screen is still black.
      Does anyone know how to do that or have any suggestions?

      J Offline
      J Offline
      JoeCFD
      wrote on 4 May 2023, 20:33 last edited by
      #2

      @Ximenes "udp://127.0.0.1:5000" does not seem to be a correct URL to me for streaming. The ip address of the streaming source(camera) on your server is needed here.

      X 1 Reply Last reply 5 May 2023, 13:21
      0
      • J JoeCFD
        4 May 2023, 20:33

        @Ximenes "udp://127.0.0.1:5000" does not seem to be a correct URL to me for streaming. The ip address of the streaming source(camera) on your server is needed here.

        X Offline
        X Offline
        Ximenes
        wrote on 5 May 2023, 13:21 last edited by
        #3

        @JoeCFD,

        Yes, I think the URL pass is incorrect anyway. But to clarify, my project connects to a device via access point and when starting the UDP connection, it starts to receive image data. For the codec, I'm using FFmpeg. As a rule, I can capture and display the images and/or save to a file using ffplay or ffmpeg, for example. However, what I would like to do is display the incoming footage in a QT object such as the QVideoWidget. I hope I have clarified the objective.

        In other versions of QT it was possible to add media with player.addMedia(QUrl("udp://XXX.X.X:YYYY")); but that option has been removed in the latest versions :(

        So anyone have any suggestions how to do it?

        J 1 Reply Last reply 5 May 2023, 13:55
        0
        • X Ximenes
          5 May 2023, 13:21

          @JoeCFD,

          Yes, I think the URL pass is incorrect anyway. But to clarify, my project connects to a device via access point and when starting the UDP connection, it starts to receive image data. For the codec, I'm using FFmpeg. As a rule, I can capture and display the images and/or save to a file using ffplay or ffmpeg, for example. However, what I would like to do is display the incoming footage in a QT object such as the QVideoWidget. I hope I have clarified the objective.

          In other versions of QT it was possible to add media with player.addMedia(QUrl("udp://XXX.X.X:YYYY")); but that option has been removed in the latest versions :(

          So anyone have any suggestions how to do it?

          J Offline
          J Offline
          JoeCFD
          wrote on 5 May 2023, 13:55 last edited by JoeCFD 5 May 2023, 13:55
          #4

          @Ximenes I am not using Qt6 for streaming. It is better to go through the latest examples of Qt6 multimedia to find that out. Maybe someone else can help you out.

          S 1 Reply Last reply 5 May 2023, 19:16
          0
          • J JoeCFD
            5 May 2023, 13:55

            @Ximenes I am not using Qt6 for streaming. It is better to go through the latest examples of Qt6 multimedia to find that out. Maybe someone else can help you out.

            S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 5 May 2023, 19:16 last edited by SGaist 5 May 2023, 19:16
            #5

            Hi,

            You are likely hitting 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

            1 Reply Last reply
            2
            • C Christian Ehrlicher referenced this topic on 7 May 2023, 09:18
            • X Offline
              X Offline
              Ximenes
              wrote on 5 Jun 2023, 16:31 last edited by Ximenes 6 May 2023, 16:31
              #6

              Hello,

              I have some good news, the last version from QT 6.5.1 solved this issue.
              Now we can stream using some protocol, like UDP or TCP, directly to a widget from QT, used as output.

              mediaPlayer->setVideoOutput(ui->widget_Video);
              QMediaPlayer* player->setSource(QUrl("udp://XXX.X.X.X:YYYY));
              
              J 1 Reply Last reply 5 Jun 2023, 17:12
              2
              • X Ximenes has marked this topic as solved on 5 Jun 2023, 16:31
              • X Ximenes
                5 Jun 2023, 16:31

                Hello,

                I have some good news, the last version from QT 6.5.1 solved this issue.
                Now we can stream using some protocol, like UDP or TCP, directly to a widget from QT, used as output.

                mediaPlayer->setVideoOutput(ui->widget_Video);
                QMediaPlayer* player->setSource(QUrl("udp://XXX.X.X.X:YYYY));
                
                J Offline
                J Offline
                JoeCFD
                wrote on 5 Jun 2023, 17:12 last edited by
                #7

                @Ximenes Good for you. Is it possible to manipulate or change the streaming settings?

                1 Reply Last reply
                0

                1/7

                4 May 2023, 20:30

                • Login

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