Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QMediaContent and binary encoded videos



  • Hi,

    I'm grabbing a binary encoded video from a database that I want to play through pyqt5's media player. All of this is in Python:
    The process is:
    encode mp4 to binary using pickle
    store on database
    decode with pickle and store as a variable
    pass that variable to setMedia(QUrl.fromlocalfile(unpickled_video))
    But that's about as far as it gets.

    I've also tried QUrl.fromEncoded() with no luck. I'm really not certain how to pass a video to setMedia that doesn't have an explicit path.
    Is there any known way of passing a binary video file saved in memory to QMediaContent?

    Thanks!
    -Mark


  • Lifetime Qt Champion

    Hi,

    Not that I remember, however you can create a temporary file where you dump the video and then play it.

    Hope it helps



  • That's my last resort. Ideally I'd like to keep any temp files off the hard drive so it doesn't slow everything down.


  • Lifetime Qt Champion

    Then depending on your OS you could make use of a ramdisk.


Log in to reply