Important: Please read the Qt Code of Conduct -

Generating .avi or .mpg animations from Qt? (from sequence of QImages or QPixmaps)

  • We are generating on-screen animations in Qt 4.8.6 widgets on Windows (just redrawing, based on a repeating QTimer). Does Qt4 or Qt5 proper support (or will Qt5 soon support) generation of .mpg / .mpeg (MPEG) or .avi files for generated animations? I'm imagining that this would be done by providing a sequence of QImages or QPixmaps having consistent dimensions, perhaps with a specified frame rate. Short of that, are there any well supported third-party Qt packages for doing this?

    Thanks in advance,
    Phil Weinstein
    CADSWES, University of Colorado

  • Take a look on "Camera Example":
    Is it what you are looking for ?

  • Thank you andrey. Re: The QtMultimediaWidgets 5.3 Camera Example. Maybe.

    But I don't see (a) any application-level API or Qt API in there which receives a QImage from the application, OR (b) virtual methods which are provided a QPainter to draw in (called asynchronously). Or something.

    What am I missing? WHERE DO I get my sequence of QImages (or QPixmaps) to a place in that code which generates movie files (MPEG or something)?

  • AFAIK there is no such API in Qt.
    Looks like Camera Example will not work for you.
    You may try to use ffmpeg or gstreamer to encode images into video.

Log in to reply