Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Displaying RTSP Stream Inside QMediaPlayer Window on i.MX6 Device
Forum Updated to NodeBB v4.3 + New Features

Displaying RTSP Stream Inside QMediaPlayer Window on i.MX6 Device

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 88 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.
  • R Offline
    R Offline
    Rethick
    wrote last edited by
    #1

    I am currently working on a project using the Toradex Colibri i.MX6DL module. In this setup, I am trying to stream video using GStreamer with integration into a Qt application.

    I am using Qt version 5.15.2 and GStreamer version 1.14. The GStreamer pipeline I am using is as follows:
    "gst-launch-1.0 rtspsrc location="rtsp://admin:admin123@192.168.1.108/cam/realmonitor?channel=1&subtype=1" latency=50 ! rtph264depay ! h264parse ! imxvpudec ! imxipuvideotransform ! video/x-raw,width=800,height=480 ! autovideosink"

    Following is the Qt Code:

    import QtQuick 2.15
    import QtMultimedia 5.15
    import QtQuick.Window 2.15
    
    Window {
        width: 800
        height: 480
        visible: true
        title: qsTr("Hello World")
    
        Rectangle{
            id:cameramainrect
            visible: true
            width: parent.width*0.5
            height: parent.height*0.5
            color: "transparent"
            
            MediaPlayer {
                        id: videoPlayer
                        videoOutput: cameraout
                        autoLoad: true
                        autoPlay: true
                       source: "gst-pipeline: rtspsrc location=rtsp://admin:admin123@192.168.1.108/cam/realmonitor?channel=1&subtype=1 latency=50 ! rtph264depay ! h264parse ! imxvpudec ! imxipuvideotransform ! video/x-raw,width=800,height=480 ! autovideosink"
                      }
                              VideoOutput {
                                  id: cameraout
                                  visible: true
                                  anchors.fill:parent
                                  fillMode: VideoOutput.PreserveAspectFit
                              }
                 }
    }```
    

    When I run this pipeline, the video stream plays correctly, but it opens in a new external window created by autovideosink. As a result, the Qt application window moves to the background, and the stream appears in front of it. My goal is to embed this video stream within the QMediaPlayer widget of my application window, rather than having it display in a separate window.

    The main objective of this implementation is to reduce CPU utilization. Directly providing the RTSP stream to the player results in high CPU usage. To offload processing from the CPU, we are leveraging hardware-accelerated decoding along with the autovideosink in the GStreamer pipeline. This combination significantly reduces CPU usage to around 20%. However, when using other video sinks instead of autovideosink, CPU utilization tends to be higher.

    Could you please advise on how I can render the video stream directly inside the QMediaPlayer area of the application? Any suggestions or changes in pipeline configuration, sink usage, or Qt integration would be greatly appreciated.

    Thank you for your support.

    1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote last edited by JoeCFD
      #2

      Take a look at the example here and use gstreamer code directly with qml sink.
      https://github.com/GStreamer/gst-plugins-good/tree/master/tests/examples/qt/qmlsink

      Do not use QMediaPlayer

      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