Congratulations to our 2022 Qt Champions!

Vewing MJPEG in a widget

  • Hi,
    Excuse me if I'm asking a question which has been answered before, but I can't, for the heck of it, switch to a suggested topic when searching on
    I have a bunch of ESP32-CAM modules with which I would like to use as a kind of security and surveillance cameras, putting them temporarily wherever I want to have an eye on something.
    Now I can view a single one with mpv but that gives me multiple windows when I want to view multiple streams. I would like to have ONE window with some viewer widgets organized in rows and columns to show ALL camera modules that I have configured, much like the commercial security camera screens.
    Does anyone have some sample code which I could adapt for this purpose? I have tried QMediaPlayer but it doesn't show anything!
    One problem I might have is that all I have is a URL http://$ip:81/stream which doesn't specify that it is an MJPEG stream.
    I don't need anything extremely fancy, I would be content with a static layout, as the configuration would not change much, so I would whip up some configuration file specifying the IP address and maybe the size and some additional parameters and then start the viewer. That's why I'm just looking for some example code which I could incorporate into my own code (for private use only).

  • Lifetime Qt Champion


    I do not have code at hand but the basic would be:

    • create a configurable widget that has the viewer (whatever widget that is) and maybe some controls like start/stop. Let's call it CameraViewer:
    • in your main widget, create as many instance of CameraViewer as you have configuration entries and put them in a QGridLayout.

Log in to reply