H.264/TS video streaming in Qt Application. How?
-
Hello all!
Is it possible in Qt Application in-box to handle H.264/TS video streaming? Does Qt Multimedia handle this format? I've been trying to find any information about supported video-streaming formats by Qt but got failed. If not is there any other alternatives? I mean something like VLC? Or the VLC - the best option? -
-
@raven-worx Is there any manual for building VLC with QT?
-
@bogong said in H.264/TS video streaming in Qt Application. How?:
Is there any manual for building VLC with QT?
Google is your friend:
https://wiki.videolan.org/Qt_Interface/https://wiki.videolan.org/LibVLC_SampleCode_Qt/ -
@Christian-Ehrlicher Have you read this manual by your own?
-
@bogong Sorry - wrong link: https://wiki.videolan.org/LibVLC_SampleCode_Qt/
-
@bogong you may want to try this VLC with Qt integration, not that I've used it but it's suggested regularly as an approach given the good support of different codecs provided by the libVLC library.
-
@Christian-Ehrlicher I've seen this before. THIS EXAMPLE of 2009 year and it's not working on on modern Qt/QML. It's using QWidget not QML. And not fitted for QML usage. Usually if I am asking about something - mean I've been checking and not found. The VLC offsite is VERY outdated.
-
@Pablo-J-Rogina What do you mean?
-
@bogong I forgot the link https://github.com/vlc-qt/vlc-qt
-
@Pablo-J-Rogina I've seen it too and already written message to the author of this implementation. This info provided @raven-worx at the second message in this thread. I am trying to understand how to use it right now.
-
@bogong said in H.264/TS video streaming in Qt Application. How?:
This info provided @raven-worx at the second message in this thread
Yes, you right sorry for the duplication. Since it shows "libVLC" I thought it referred to the plain library, I didn't follow the link, my bad.
There's a QML player example just in case.
-
@Pablo-J-Rogina Thanks for assistance a lot :-) It's not bad ... :-)
-
Just got a reply from author of vlc-qt:
Checkout the platform/mobile branch. There you have specific toolchains available to build for android and iOS. A few disclaimers: I did not have time to test this for more than 4 years. The performance is not optimised.
-
Published messages on native VLC forum:
https://forum.videolan.org/viewtopic.php?f=32&t=152944
https://forum.videolan.org/viewtopic.php?f=32&t=152943Now awaiting reply.
-
Duuuude..... I banged my head against this problem for sooooooo long.
Heres what you need to do:
Download the nighltly builds of libvlc so that you dont need build them yourself, in my case I needed it on windows. I use mingw 64 bit compiler so I got those versions.
https://nightlies.videolan.org/build/win64/(i then put those lib files into my "C:\Program Files\VideoLAN\VLC\sdk" directory)
Next clone the vlc-qt source
github.com/vlc-qt/vlc-qt.gitOpen Qt Creator and go open file or project, select the CMakeLists.txt file in the top level. So long as all the tools are installed qt creator should configure the project. Make sure everything is found correctly. When I first tried this approach it could not find the SDK lib files. I tried to build them manually (cross compile) which was a complete disaster. If you get the nightly build and it works hold that copy CLOSE haha.
Once you build it you will get all your libvlc library files.
For your qmake .pro files (since all their examples are in cmake, which does not help most qt users as they are probably using qmake) heres what I add. I made a vlc-qt directory in my source code directory that has the include folder with the libraries header files, and coppied the built .dll files into the libs folder. told qmake where to find them.
INCLUDEPATH += "$$PWD/vlc-qt/include" LIBS += "$$PWD/vlc-qt/libs/mingw64/libVLCQtQml.dll" LIBS += "$$PWD/vlc-qt/libs/mingw64/libVLCQtCore.dll"
In your build directory: you need to add these files/folders....
copy the plugins folder from the vlc install dir.
C:\Program Files\VideoLAN\VLC\plugins >>> C:\dev\PROJECT\build-PROJECT-Desktop_Qt_5_12_6_MinGW_64_bit-Release\release\pluginsAlso copy the following dlls into your application's directory, in my case C:\dev\PROJECT\build-PROJECT-Desktop_Qt_5_12_6_MinGW_64_bit-Release\release
libvlc.dll
libvlccore.dll
libVLCQtCore.dll
libVLCQtQml.dll (if you're doing qml, in my case I am)
VLCQt.dll
(libvlc.dll and libvlccore.dll I grabbed right from C:\Program Files\VideoLAN\VLC directory)For further assistance heres my qml snippet:
import QtQuick 2.0 import VLCQt 1.0 Item { VlcVideoPlayer { id: vidwidget anchors.fill: parent url: Bridge.currentCameraUrl onStateChanged: console.log("state changed!" + state) } Rectangle { id: rect anchors.centerIn: parent visible: (vidwidget.state == 6) || (vidwidget.state == 7) || (vidwidget.state == 1) width: parent.width * .3 height: parent.height * .1 color: "Gray" opacity: .8 radius: 2 } Text { anchors.centerIn: parent width: rect.width height: rect.height text: (vidwidget.state == 1) ? qsTr("Connecting camera...") : qsTr("Camera Not Found!") color: (vidwidget.state == 1) ? "Blue" : "Red" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font.bold: true font.family: "Ubuntu" font.pixelSize: 15 } }
and in c++
to get QML going add these headers and these lines of code to main function:#include <VLCQtCore/Common.h> #include <VLCQtQml/QmlVideoPlayer.h> VlcCommon::setPluginPath(app.applicationDirPath() + "/plugins"); VlcQmlVideoPlayer::registerPlugin();
Anyways long post but I hope it helps, if you're on linux/ios/android I am sure the same general approach applies, you can get nightly builds for each of those OSes
https://nightlies.videolan.org/.
Good luck let me know if you get stuck bud! -
@MrShawn did you see "unresolved external" problems when build the qt-vlc source code with QtCreator (MSVC 2019). ?
I checked the headers and source file, they are ok but they keep showing error like that.
I run steps to build from guideline in here
https://github.com/vlc-qt