Qt6 Multimedia Streaming
-
Qt Gurus,
I have designed an application that uses libVLC to overlay multicast TS/UDP video streams onto a QWindow. This approach works, but it is far from ideal from a development perspective. I noticed that Qt6 has a multimedia module that supports video playback from various sources (file, http, etc) and I was wondering if it could perhaps replace libVLC in my application.
The main issue that I see so far is that I would have to somehow adapt the QMediaPlayer to support getting a video buffer from a multicast UDP socket instead of a URL. Looking at QMediaPlayer.setSourceDevice it may be possible for me to implement a socket that adds the video frames to an IO device, or to use the socket directly. Another potential issue is that the buffer format may not be compliant with what QMediaPlayer expects as input, not quite sure how I would fix that...
Has anyone accomplished this or something similar using Qt6 Multimedia? Insights would be greatly appreciated!
Thanks!
M -
It may have changed since I last futzed with it, but my understanding was that the Qt multimedia framework was a front-end for an underlying backend like libVLC, so unless the model has changed you're still stuck with a native backend library, probably that which you strive to get away from.
-
It may have changed since I last futzed with it, but my understanding was that the Qt multimedia framework was a front-end for an underlying backend like libVLC, so unless the model has changed you're still stuck with a native backend library, probably that which you strive to get away from.
@Kent-Dorfman it did have changed indeed.
QtMultimedia got a very big overhaul for Qt 6. Since several releases, the default backend is powered by ffmpeg. While the native backend are still available, they won't be developed further.
@Molecular4943 sorry I can't answer that one as I haven't done something like that. I think it's worth investing. Out of curiosity, what is your issue with libVLC ?
-
@Kent-Dorfman it did have changed indeed.
QtMultimedia got a very big overhaul for Qt 6. Since several releases, the default backend is powered by ffmpeg. While the native backend are still available, they won't be developed further.
@Molecular4943 sorry I can't answer that one as I haven't done something like that. I think it's worth investing. Out of curiosity, what is your issue with libVLC ?
@SGaist said in Qt6 Multimedia Streaming:
Out of curiosity, what is your issue with libVLC ?
I have no issues from a functionality perspective, it works as intended. It would be easier from a dependency management perspective if I could just use Qt6 dependencies.
Additionally, it would be nice if I had more control over the socket for the video frames (preferably with QUdpSocket) because currently the streaming is handled simply by configuring libVLC urls:
udp://@239.54.0.1:5566
. This way, libVLC manages the connection instead which isn't ideal for me.I'm going to start playing around with Qt6 Multimedia to see if I can get something working using a UDP socket.
Thanks for the input!
M -
@SGaist said in Qt6 Multimedia Streaming:
Out of curiosity, what is your issue with libVLC ?
I have no issues from a functionality perspective, it works as intended. It would be easier from a dependency management perspective if I could just use Qt6 dependencies.
Additionally, it would be nice if I had more control over the socket for the video frames (preferably with QUdpSocket) because currently the streaming is handled simply by configuring libVLC urls:
udp://@239.54.0.1:5566
. This way, libVLC manages the connection instead which isn't ideal for me.I'm going to start playing around with Qt6 Multimedia to see if I can get something working using a UDP socket.
Thanks for the input!
M@Molecular4943 I do not think Qt multimedia has great features for streaming. You can use gstreamer directly with qml sink for better controls.
https://github.com/GStreamer/gst-plugins-good/blob/master/tests/examples/qt/qmlsink/main.cppVLC seems a good tool. But we decided to use gstreamer a few years ago. FFmpeg is a good option as well.
-
Why not use ffmpeg? It is better for rtsp, network streaming etc.
https://github.com/denisgottardello/QtFFmpegPlayer -
@SGaist said in Qt6 Multimedia Streaming:
Out of curiosity, what is your issue with libVLC ?
I have no issues from a functionality perspective, it works as intended. It would be easier from a dependency management perspective if I could just use Qt6 dependencies.
Additionally, it would be nice if I had more control over the socket for the video frames (preferably with QUdpSocket) because currently the streaming is handled simply by configuring libVLC urls:
udp://@239.54.0.1:5566
. This way, libVLC manages the connection instead which isn't ideal for me.I'm going to start playing around with Qt6 Multimedia to see if I can get something working using a UDP socket.
Thanks for the input!
M@Molecular4943 you can try Opencv. With opencv you will have control over the frames. I use it to stream cameras url.I think it also support rstp