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. QGraphicsView not displaying QMediaPlayer's output that's using Gstreamer pipeline, instead just opens a new video window
QtWS25 Last Chance

QGraphicsView not displaying QMediaPlayer's output that's using Gstreamer pipeline, instead just opens a new video window

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 4 Posters 1.7k 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.
  • BallasB Offline
    BallasB Offline
    Ballas
    wrote on last edited by Ballas
    #2

    In the pipeline you have mentioned that ximagesink as the final sink plugin. The function of the ximagesink is to launch a new window. If you require the video frame to be displayed on the graphics view, you will have to use appsink as the final sink plugin.

    Another approach will be to use the QtGst library to render the video. Please look at the demo examples on this Github repository.

    https://github.com/GStreamer/qt-gstreamer/tree/master/examples

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

      Hi,

      As explained in the method documentation, you need to have a sink that is named qtvideosink.

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

      C 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        As explained in the method documentation, you need to have a sink that is named qtvideosink.

        C Offline
        C Offline
        caha11
        wrote on last edited by
        #4

        @SGaist Hey thanks for the reply. Yes it does work for QVideoWidget and I have tried that and it worked for QVideoWidget specifically. However, I'm trying to play the video in QGraphicsView here, and I have tried using qtvideosink as the name of the sink and that didn't do anything for my situation. The reason why I'm trying to use the QGraphicsView is because I need to put widgets on top, which QVideoWidget doesn't allow transparent backgrounds for. I've seen it work for QGraphicsView which is why I'm pursuing this method of displaying the video.

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

          What about QGraphicsVideoItem ?

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

          C 1 Reply Last reply
          1
          • SGaistS SGaist

            What about QGraphicsVideoItem ?

            C Offline
            C Offline
            caha11
            wrote on last edited by
            #6

            @SGaist Thanks for replying again!

            Yes I'm trying that, as it is shown above,
            I set video output of QMediaPlayer to QGraphicsVideoItem which is an item of QGraphicsScene that belongs to QGraphicsView. I'm suspecting that it might be a bug or other issue that I'm not aware of.

            From using the QVideoWidget before, I found that if the sink is not compatible with the widget, then it will create an external window. I was using glimagesink before, and with QVideoWidget the video would display in a new window. However, with ximagesink the QVideoWidget displayed it internally. Hence, it could be that QGraphicsView setup might not be compatible with either sinks (glimagesink and ximagesink, I tried both). I tried the appsink suggestion above but it didn't work either.

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

              Based on the setMedia documentation., you seem to be missing the name=qtvideosink part for your sink.

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

              C 1 Reply Last reply
              0
              • SGaistS SGaist

                Based on the setMedia documentation., you seem to be missing the name=qtvideosink part for your sink.

                C Offline
                C Offline
                caha11
                wrote on last edited by
                #8

                @SGaist Yes, as I said before, I tried that. And I tried it again now. Same situation as before, video stream is working fine, but it opens a new window instead of displaying it inside QGraphicsView.

                player->setMedia(QUrl("gst-pipeline: udpsrc port=5801 ! application/x-rtp,payload=(int)96,encoding-name=(string)H264,clock-rate=(int)90000 ! rtpjitterbuffer latency=50 ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! ximagesink name=qtvideosink"));
                
                
                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  RGutstein
                  wrote on last edited by
                  #9

                  Hi everyone!

                  Set video output before setting the pipeline.
                  player->setVideoOutput(videoItem);
                  and then
                  player->setMedia(QUrl("gst-pipeline: udpsrc port=5801 ! application/x-rtp,payload=(int)96,encoding-name=(string)H264,clock-rate=(int)90000 ! rtpjitterbuffer latency=50 ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! ximagesink name=qtvideosink"));

                  SGaistS C 2 Replies Last reply
                  2
                  • R RGutstein

                    Hi everyone!

                    Set video output before setting the pipeline.
                    player->setVideoOutput(videoItem);
                    and then
                    player->setMedia(QUrl("gst-pipeline: udpsrc port=5801 ! application/x-rtp,payload=(int)96,encoding-name=(string)H264,clock-rate=(int)90000 ! rtpjitterbuffer latency=50 ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! ximagesink name=qtvideosink"));

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

                    @RGutstein said in QGraphicsView not displaying QMediaPlayer's output that's using Gstreamer pipeline, instead just opens a new video window:

                    Hi everyone!

                    Set video output before setting the pipeline.
                    player->setVideoOutput(videoItem);
                    and then
                    player->setMedia(QUrl("gst-pipeline: udpsrc port=5801 ! application/x-rtp,payload=(int)96,encoding-name=(string)H264,clock-rate=(int)90000 ! rtpjitterbuffer latency=50 ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! ximagesink name=qtvideosink"));

                    Thanks !

                    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
                    • R RGutstein

                      Hi everyone!

                      Set video output before setting the pipeline.
                      player->setVideoOutput(videoItem);
                      and then
                      player->setMedia(QUrl("gst-pipeline: udpsrc port=5801 ! application/x-rtp,payload=(int)96,encoding-name=(string)H264,clock-rate=(int)90000 ! rtpjitterbuffer latency=50 ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! ximagesink name=qtvideosink"));

                      C Offline
                      C Offline
                      caha11
                      wrote on last edited by
                      #11

                      I'm unable to test this anymore due to not having the hardware, so hopefully this will work for someone who has the same problem.

                      Thanks for the suggestion,

                      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