Important: Please read the Qt Code of Conduct -

What Widget to use for video playback from Live Stream?

  • I am currently porting one of my .NET Projects over to C++ that plays live RTMP/RTSP Streams and have decided to use the Qt Framework for the GUI. I am using the "librtmp" library (used in XBMC/RTMPDump/etc) and it works currently by downloading the individual packets receiving and stuffing them into an .flv file.

    I would instead like to take the packets received and display them in a Video Widget, but am unsure as to what widget to use or how exactly to do this with Qt. Would anyone be able to offer some assistance with this? I really like the looks of the Phonon Multimedia Framework, and am looking over the video player example now, but not sure how I would use the data from librtmp in conjunction with it.

    Here is my C# loop code that grabs the packet data and writes it to a file...

    @ using (FileStream FS = File.Open("C:\teststream.flv", FileMode.Create, FileAccess.Write))
    while (true)
    bytes_read = LibRTMP.RTMP_Read(rtmp, b, b.Length);

                    if (bytes_read == 0)
                    FS.Write(b, 0, bytes_read);

  • You might want to take a look at this: .

    Highlights: Use QtMultimedia's QAbstractVideoSurface to paint onto a QWidget.

  • Thank you, that does look like a solid option. The Phonon Multimedia Player and the QAbstractionVideoSurface could both potentially work perfect for my needs.

    I am still at a loss on how to play the byte stream that I am receiving into either of these though. Do you have any idea how I could go about feeding that data into one of these widgets as opposed to stuffing it into an FLV file?

  • I'd say phonon is a bit heavy for what you want. Seriously, look at that example. It shows you exactly how to do what you want. Look at the VideoPlayer::presentImage() function.

Log in to reply