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. QTMultimedia FFMPEG backend preview
Forum Update on Monday, May 27th 2025

QTMultimedia FFMPEG backend preview

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
13 Posts 3 Posters 2.9k 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.
  • S Offline
    S Offline
    sethsource
    wrote on last edited by sethsource
    #3

    On Linux, this code displays an RTSP stream. and I know that ffmpeg supports this, as i've created a .NET program using ffmpeg to do something similar. I just want to make this with QT/QML

    import QtQuick
    import QtMultimedia
    import QtQml.Models 2.3
    Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("CSACamera")
        color: "#000000"
        Video {
                id: stream
                anchors.fill: parent
                focus: true
                source: "rtsp://admin:CSACamera18@192.168.2.18/h264_stream"
                opacity: 1.0
                fillMode: Image.Stretch
                muted: true
                onStopped: stream.play()
                Timer {
                        interval: 300000; running: true; repeat: true
                        onTriggered: {
                            console.log("Log: Refresh")
                            stream.stop()
                            stream.source="rtsp://admin:CSACamera18@192.168.2.18/h264_stream"
                            stream.play()
                        }
                    }
    //            onErrorChanged: {
    //                console.log("VIDEO ERROR")
    //                stream.stop()
    //                stream.source="rtsp://admin:CSACamera18@192.168.2.18/h264_stream"
    //                stream.play()
    //            }
    
                Text {
                    id: text1
                    width: 73
                    height: 18
                    color: "#ffffff"
                    text: qsTr("Audio: False")
                    anchors.left: parent.left
                    anchors.top: parent.top
                    font.pixelSize: 15
                    anchors.leftMargin: 0
                    anchors.topMargin: 0
                }
    
                Keys.onPressed: (event)=> {
                    if(event.key === Qt.Key_M) {
                        if(text1.text === "Audio: True") {
                            text1.text = "Audio: False"
                            stream.muted = true
                        } else if (text1.text === "Audio: False") {
                            text1.text = "Audio: True"
                            stream.muted = false
                        }
                    }
                }
        }
    }
    
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      sethsource
      wrote on last edited by sethsource
      #4
      This post is deleted!
      1 Reply Last reply
      0
      • S Offline
        S Offline
        sethsource
        wrote on last edited by
        #5
        This post is deleted!
        1 Reply Last reply
        0
        • S Offline
          S Offline
          sethsource
          wrote on last edited by
          #6
          This post is deleted!
          1 Reply Last reply
          0
          • S Offline
            S Offline
            sethsource
            wrote on last edited by
            #7

            buimp .

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

              Hi,

              Did you check whether the plugin was deployed ?
              If not, did you try to build it yourself ?

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

              S 1 Reply Last reply
              0
              • SGaistS SGaist

                Hi,

                Did you check whether the plugin was deployed ?
                If not, did you try to build it yourself ?

                S Offline
                S Offline
                sethsource
                wrote on last edited by
                #9

                @SGaist How would i check to see if it's deployed? and also there's no instructions anywhere on how to build the preview with FFMPEG included

                JoeCFDJ 1 Reply Last reply
                0
                • S sethsource

                  @SGaist How would i check to see if it's deployed? and also there's no instructions anywhere on how to build the preview with FFMPEG included

                  JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by JoeCFD
                  #10

                  @sethsource from Qt6.5, FFMPEG comes as default. Check the folder /plugins/multimedia and you will be able to see the plugin is there. If you use Qt6.4, you have to set QT_MEDIA_BACKEND. From all changes they are making, you may not be surprised by issues. Qt6.5 is under beta and Qt6.6 is under dev. I guess you have to be patient with this app.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    sethsource
                    wrote on last edited by
                    #11

                    QT6.4 didnt work with FFMPEG out of the box, as well as 6.6. I'll try 6.5.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      sethsource
                      wrote on last edited by
                      #12

                      Okay now we're getting somewhere. QT6.5 with msvc allows me to run my program without yelling at me. only thing now is it seems it wants me to specify a "decoding framework". heres the output:

                      Cant seem to find any environment variables on the internet that i can use.

                      Available HW decoding frameworks:
                      dxva2
                      d3d11va

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        sethsource
                        wrote on last edited by
                        #13

                        I read on an ffmpeg forum that people make the use of dxva2 and d3d11va through a command line argument for video...
                        "ffmpeg -hwaccel dxva2 -threads 1 -i INPUT -f null - -benchmark"

                        but this is completely unrelated to QT. I attempted to use an envar for hwaccel and using command line arg and no difference.

                        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