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.7k 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 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?

    JoeCFDJ 1 Reply Last reply
    0
    • X Ximenes

      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?

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on 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
      0
      • JoeCFDJ JoeCFD

        @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 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?

        JoeCFDJ 1 Reply Last reply
        0
        • X Ximenes

          @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?

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #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.

          SGaistS 1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

            @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.

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by SGaist
            #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
            • Christian EhrlicherC Christian Ehrlicher referenced this topic on
            • X Offline
              X Offline
              Ximenes
              wrote on last edited by Ximenes
              #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));
              
              JoeCFDJ 1 Reply Last reply
              2
              • X Ximenes has marked this topic as solved on
              • X Ximenes

                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));
                
                JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by
                #7

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

                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