Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. H.264/TS video streaming in Qt Application. How?

H.264/TS video streaming in Qt Application. How?

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 7 Posters 4.0k Views 2 Watching
  • 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.
  • B bogong

    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-worxR Offline
    raven-worxR Offline
    raven-worx
    Moderators
    wrote on last edited by
    #2

    @bogong
    depends on your system. Qt directly doesnt decode video, but is using system backends to do so (like gstreamer on Linux, which requires to install corresponding plugin packages).

    As an alternative there is libVLC.

    I cant tell how good support for H.264 is as of today though.

    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
    If you have a question please use the forum so others can benefit from the solution in the future

    B 1 Reply Last reply
    2
    • raven-worxR raven-worx

      @bogong
      depends on your system. Qt directly doesnt decode video, but is using system backends to do so (like gstreamer on Linux, which requires to install corresponding plugin packages).

      As an alternative there is libVLC.

      I cant tell how good support for H.264 is as of today though.

      B Offline
      B Offline
      bogong
      wrote on last edited by
      #3

      @raven-worx Is there any manual for building VLC with QT?

      1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by Christian Ehrlicher
        #4

        @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/

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        B 1 Reply Last reply
        -1
        • Christian EhrlicherC Christian Ehrlicher

          @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/

          B Offline
          B Offline
          bogong
          wrote on last edited by
          #5

          @Christian-Ehrlicher Have you read this manual by your own?

          Christian EhrlicherC Pablo J. RoginaP 2 Replies Last reply
          0
          • B bogong

            @Christian-Ehrlicher Have you read this manual by your own?

            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @bogong Sorry - wrong link: https://wiki.videolan.org/LibVLC_SampleCode_Qt/

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            B 1 Reply Last reply
            0
            • B bogong

              @Christian-Ehrlicher Have you read this manual by your own?

              Pablo J. RoginaP Offline
              Pablo J. RoginaP Offline
              Pablo J. Rogina
              wrote on last edited by Pablo J. Rogina
              #7

              @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.

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              B 1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                @bogong Sorry - wrong link: https://wiki.videolan.org/LibVLC_SampleCode_Qt/

                B Offline
                B Offline
                bogong
                wrote on last edited by bogong
                #8

                @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.

                1 Reply Last reply
                0
                • Pablo J. RoginaP Pablo J. Rogina

                  @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.

                  B Offline
                  B Offline
                  bogong
                  wrote on last edited by
                  #9

                  @Pablo-J-Rogina What do you mean?

                  Pablo J. RoginaP 1 Reply Last reply
                  0
                  • B bogong

                    @Pablo-J-Rogina What do you mean?

                    Pablo J. RoginaP Offline
                    Pablo J. RoginaP Offline
                    Pablo J. Rogina
                    wrote on last edited by
                    #10

                    @bogong I forgot the link https://github.com/vlc-qt/vlc-qt

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    B 1 Reply Last reply
                    0
                    • Pablo J. RoginaP Pablo J. Rogina

                      @bogong I forgot the link https://github.com/vlc-qt/vlc-qt

                      B Offline
                      B Offline
                      bogong
                      wrote on last edited by bogong
                      #11

                      @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.

                      Pablo J. RoginaP 1 Reply Last reply
                      0
                      • B bogong

                        @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.

                        Pablo J. RoginaP Offline
                        Pablo J. RoginaP Offline
                        Pablo J. Rogina
                        wrote on last edited by
                        #12

                        @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.

                        Upvote the answer(s) that helped you solve the issue
                        Use "Topic Tools" button to mark your post as Solved
                        Add screenshots via postimage.org
                        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                        B 1 Reply Last reply
                        0
                        • Pablo J. RoginaP Pablo J. Rogina

                          @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.

                          B Offline
                          B Offline
                          bogong
                          wrote on last edited by
                          #13

                          @Pablo-J-Rogina Thanks for assistance a lot :-) It's not bad ... :-)

                          1 Reply Last reply
                          0
                          • B Offline
                            B Offline
                            bogong
                            wrote on last edited by
                            #14

                            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.
                            
                            1 Reply Last reply
                            0
                            • B Offline
                              B Offline
                              bogong
                              wrote on last edited by
                              #15

                              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=152943

                              Now awaiting reply.

                              1 Reply Last reply
                              1
                              • M Offline
                                M Offline
                                MrShawn
                                wrote on last edited by MrShawn
                                #16

                                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.git

                                Open 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\plugins

                                Also 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!

                                B chaupadC 2 Replies Last reply
                                3
                                • M MrShawn

                                  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.git

                                  Open 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\plugins

                                  Also 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!

                                  B Offline
                                  B Offline
                                  bogong
                                  wrote on last edited by
                                  #17

                                  @MrShawn It's not exactly of what I've been seeking for. But never the less - THX a lot. I will take the directions of developing from your post and trying to implement it for mobile platforms.

                                  1 Reply Last reply
                                  0
                                  • B Offline
                                    B Offline
                                    Bonnie
                                    wrote on last edited by
                                    #18

                                    Hi, you may give QtAV a try.

                                    1 Reply Last reply
                                    0
                                    • M MrShawn

                                      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.git

                                      Open 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\plugins

                                      Also 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!

                                      chaupadC Offline
                                      chaupadC Offline
                                      chaupad
                                      wrote on last edited by
                                      #19

                                      @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

                                      MFA Team - We build your dream
                                      https://MakeFamousApp.com

                                      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