I'm needing to display RTSP footage through a QML application. I have code written for this that works perfectly on Linux, simply because QT ships with a gstreamer backend on linux straight out of the box. On Windows this is a different story. Windows comes with "Windows Media Foundation" which doesn't support hardly any formats/codecs, much less an rtsp stream.
QT says with the release of QT6.4 they added an FFMPEG backend as a preview(https://doc-snapshots.qt.io/qt6-6.4/qtmultimedia-index.html). Some people on articles claim theyve gotten a working version by compiling QT with ffmpeg(https://forum.qt.io/topic/140524/use-ffmpeg-with-qt6-4/16). Everyone fails to produce steps and detailed information. I'm needing some help getting my QT6.4 installation to work with a ffmpeg backend. Also I've tried it with the mentioned environment variable as well.
If we can solve this here, we would be benefiting TONS of people. I can't tell you how many people have been posting about this.
Here's the quote from QT:
"Target platform and backend notes On most platforms, there are two different backends that can be used for Qt Multimedia.
The first one is the backend built on the native multimedia framework of the underlying >operating system. This is currently the default, and will use gstreamer on Linux, >AVFoundation on macOS/iOS, WMF on Windows, and the MediaCodec framework on Android.
While we try to support our full API on all backends using the native multimedia framework, >platform specific limitations do exist in a few places. This is due to the fact that the >feature set supported by those frameworks varies, implying that some functionality might >not be available on all platforms. This is especially true for the set of supported file >formats and codecs, as well as advanced camera functionality.
Where limitations exist, we aim to document those in the respective classes and methods.
With Qt 6.4, we are adding a new, more platform independent backend based on the FFmpeg >framework. The FFmpeg backend is currently available as a technology preview. This backend >has the advantage that we can offer proper cross-platform support for all features of Qt >Multimedia, going beyond the limitations that exist with many of the native frameworks.
You can test the FFmpeg backend right now by using a Qt build that has FFmpeg enabled and >setting the QT_MEDIA_BACKEND environment variable to ffmpeg:
export QT_MEDIA_BACKEND=ffmpeg"
And here's my WORKING code on Linux:
import QtQuick
import QtMultimedia
import QtQml
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
color: "#000000"
Video {
id: stream
anchors.fill: parent
focus: true
source: "MY URL"
opacity: 1.0
fillMode: Image.Stretch
muted: true
Timer {
interval: 300000; running: true; repeat: true
onTriggered: {
console.log("Log: Refresh")
stream.stop()
stream.source="MY URL"
stream.play()
}
}
onErrorChanged: {
console.log("VIDEO ERROR")
stream.stop()
stream.source="MY URL"
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) {
stream.play()
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
}
}
}
}
// Component.onCompleted: {
// stream.play()
// }
}