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. How to play raw video data in Qt
Forum Updated to NodeBB v4.3 + New Features

How to play raw video data in Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 3.9k Views 3 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.
  • P Offline
    P Offline
    Prashant_Ben
    wrote on last edited by
    #1

    Hi, i am new to Qt and i want to know how can i play a raw video(.yuv) frames by frame in qt, i don't want to pass the file path or url to qt, just the buffer containing video data.
    Thanks in advance

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

      Hi and welcome to devnet,

      How are you getting the data from the video file ?

      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
      • P Offline
        P Offline
        Prashant_Ben
        wrote on last edited by
        #3

        Thanks for the reply @SGaist.
        Actually i am having a ts stream(which contains my video), which i am decoding externally and not in Qt, the decoded output i am taking in buffer and want to pass that buffer to Qt.

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

          What format is that buffer ?
          What library are you using to decode the file ?

          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
          • P Offline
            P Offline
            Prashant_Ben
            wrote on last edited by Prashant_Ben
            #5

            Hi @SGaist ,
            -> raw video data format is yuv420p.
            -> i am going to use libavcodec(FFmpeg) to decode the file.

            I tried a small sample yesterday but couldn't get on how to set the raw data format, here it is:

            int main(int argc, char *argv[])
            {
                QApplication a(argc, argv);
            
                QFile file("/out.yuv");    //this is just for sample, will not be there in actual app
                file.open(QIODevice::ReadOnly);
                QByteArray arr = file.readAll(); 
            
                QMediaPlayer *player = new QMediaPlayer(&a);
            
                QBuffer *buffer = new QBuffer(player);
                buffer->setData(arr);
                buffer->open(QIODevice::ReadOnly);
            
                player->setMedia(QMediaContent(),buffer);
            
                player->play();
            
                return a.exec();
            }
            
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Then also use it to convert the YUV frame into an RGB frame. Or maybe consider the QtAV project.

              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
              1
              • K Offline
                K Offline
                kuzulis
                Qt Champions 2020
                wrote on last edited by
                #7

                Or, to use the libvlc wrappers, e.g. vlc-qt

                1 Reply Last reply
                2

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved