Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. Play H.264 Elementary Stream
Forum Updated to NodeBB v4.3 + New Features

Play H.264 Elementary Stream

Scheduled Pinned Locked Moved Brainstorm
16 Posts 5 Posters 21.2k 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.
  • H Offline
    H Offline
    HeresJonny
    wrote on last edited by
    #1

    I am receiving an H.264 elementary stream from a camera and would like to create a Qt application to play it back. I can find plenty of examples of playing back files with a standard container (i.e. MP4), but is there any way to pass in individual H.264 frames to some Qt class for it to decode and render?

    If someone with knowledge of the Qt multimedia APIs could help me, I'd like to know:

    1. If this is even possible
    2. Which multimedia API I could use to do this
    3. Which classes I should look at to get started
    4. Which platforms this would actually be supported on
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      I'd recommend to also try on the interest mailing list. You'll find there Qt's developers/maintainers (this forum is more user oriented)

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

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vincent007
        wrote on last edited by
        #3

        use QVideoFrame, QVideoProbe and QMediaPlayer.

        1 Reply Last reply
        0
        • H Offline
          H Offline
          HeresJonny
          wrote on last edited by
          #4

          The documentation for QVideoFrame seems to indicate that it is used to hold the pixels from a decoded frame, whereas I would like to feed in H.264-encoded frames. I could put an external decoder in front of the QVideoFrame, but I am curious whether there is a solution for this purely within Qt.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andreyc
            wrote on last edited by SGaist
            #5

            Qt does not know how to decode h.264.
            It uses an "OS backend":http://doc.qt.io/qt-5/multimediaoverview.html#limitations to decode video.

            Take a look "here":http://doc.qt.io/qt-5/videooverview.html#working-with-low-level-video-frames for low level example within Qt

            [edit: updated the links SGaist]

            1 Reply Last reply
            0
            • V Offline
              V Offline
              Vincent007
              wrote on last edited by
              #6

              QMediaPlayer cannot help you? QMediaPlayer can decode video files.

              1 Reply Last reply
              0
              • BonganiB Offline
                BonganiB Offline
                Bongani
                wrote on last edited by
                #7

                @HeresJonny and @SGaist , Did you finally find a solution for this problem ?

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

                  The links provided by @andreyc are a good starting point.

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

                  1 Reply Last reply
                  0
                  • BonganiB Offline
                    BonganiB Offline
                    Bongani
                    wrote on last edited by
                    #9

                    @SGaist i am receiving raw h264 frames from a QTCP socket, i need a function or library where i will pass the h264 data (QByteArray) from a http payload, and decode it to pass it to a video player. The QT Multimedia library doesn't work with encoded data. i already tried using the QTAV library but there's is no luck in Reaching what i need. Please help.

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

                      What OS are you targeting ?

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

                      1 Reply Last reply
                      0
                      • BonganiB Offline
                        BonganiB Offline
                        Bongani
                        wrote on last edited by
                        #11

                        @SGaist Windows, Preferably 7 to 10.

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

                          Do you have any h264 codec installed ?

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

                          1 Reply Last reply
                          0
                          • BonganiB Offline
                            BonganiB Offline
                            Bongani
                            wrote on last edited by
                            #13

                            @SGaist Yes, unfortunately VLC-QT from https://vlc-qt.tano.si doesn't support the particular functionality i require. i also tried using the QTAV library from http://www.qtav.org, which uses the ffmpeg library. none of these are of help because they don't support raw h264 bit streaming. you can check my conversation with on of the repository admins here https://github.com/wang-bin/QtAV/issues/510. I was wondering if QT has a library i could pass my QByteArray data (raw h264 data) from a QTCPSocket and decodes the bit-stream and stream it live.

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

                              Are you sure that FFMPEG doesn't help ? See this

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

                              1 Reply Last reply
                              0
                              • BonganiB Offline
                                BonganiB Offline
                                Bongani
                                wrote on last edited by
                                #15

                                @SGaist

                                AVPacket avpkt; int err, frame_decoded = 0;
                                AVCodec *codec = avcodec_find_decoder ( AV_CODEC_ID_H264 );
                                AVCodecContext *codecCtx = avcodec_alloc_context3 ( codec );
                                avcodec_open2 ( codecCtx, codec, NULL );
                                // Set avpkt data and size here
                                err = avcodec_decode_video2 ( codecCtx, avframe, &frame_decoded, &avpkt );
                                
                                

                                avframe being the QByteArray data from the socket ?

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

                                  You'll likely have build your avframe with the data contained by the QByteArray

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

                                  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