Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. PyQt5 -- loading serialized videos for playback
Qt 6.12 LTS is out! See what's new in the release blog

PyQt5 -- loading serialized videos for playback

Scheduled Pinned Locked Moved Unsolved Language Bindings
11 Posts 2 Posters 5.4k Views 1 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.
  • understatementOfTheYearU Offline
    understatementOfTheYearU Offline
    understatementOfTheYear
    wrote on last edited by
    #2

    Currently looking at QDataStream...might have the answer.

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

      Hi,

      What do you mean by serialized videos ?

      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
      • understatementOfTheYearU Offline
        understatementOfTheYearU Offline
        understatementOfTheYear
        wrote on last edited by
        #4

        Binary data

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

          I'm afraid that's a bit vague.

          What format ?
          What container ?

          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
          • understatementOfTheYearU Offline
            understatementOfTheYearU Offline
            understatementOfTheYear
            wrote on last edited by
            #6

            Sorry, I'm still a bit new to doing this but the format is mp4. Not sure what you mean by container but the file was serialized through pymongo using gridfs.

            I used the same process to serialize jpeg images and I am able to view them with PyQt using QPixmap().loadFromData().
            I was just hoping there was an equivalent with QMediaPlayer for videos.

            Thanks!

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

              AFAIK, no.

              However you can copy the data to a temporary file and open it with QMediaPlayer.

              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
              • understatementOfTheYearU Offline
                understatementOfTheYearU Offline
                understatementOfTheYear
                wrote on last edited by
                #8

                Ah, that's unfortunate. I was hoping to avoid creating temp files and the like.

                Thanks!

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

                  It's something that is pretty easy with Qt, look at QTemporaryFile

                  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
                  • understatementOfTheYearU Offline
                    understatementOfTheYearU Offline
                    understatementOfTheYear
                    wrote on last edited by
                    #10

                    I've been reading up on QIODevice and streaming the video but I've been getting errors:

                    here's the code

                            a = QByteArray(video_from_binary)
                            b = QBuffer(a)
                            self.mediaPlayer.setMedia(QMediaContent(b))
                    
                    

                    where self.mediaPlayer is my media player attribute.
                    I've also seen where a 'QUrl.fromLocalFile()' is passed to setMedia.
                    I tried 'QUrl.fromEncoded(b)' assuming this might read binary data but to no avail. It still didn't work.

                    If anyone has gotten videos to stream, would you be so kind as to share how you did it? I tried calling the actual video I converted to binary from and it works fine (an .avi) but no such luck for the binary version.

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

                      AFAIK, there's no support for "in-memory files" like that. Remember that QtMultimedia uses the platform's multimedia framework which don't handle Qt types. If you take for example the handling of Qt's resource system when dealing with multimedia files, a temporary file is created so that the multimedia framework can access it.

                      If you want something lower level to avoid the temporary file, you'll have to implement it yourself.

                      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
                      • Unsolved