Important: Please read the Qt Code of Conduct -

How to create a video file with an audio track?

  • I've been reading the documentation on QMediaRecorder, trying to figure out how I might be able to use it to generate a video file. Most of the documentation for this and related classes seem to presume some sort of streaming is going on, where you're routing data from a camera or an existing video directly to the destination file without many changes.

    I'd like to do something different. I want to generate original image data and combine it with several different audio clips to generate a final composite file. Basically, I'm trying to create a movie editor and want to have the program mix various clips of footage with soundtracks, sound effects and user generated items like floating text. Is there a way to do this?

    Also, I noticed that Qt includes the ffmpeg license agreement as part of its documentation. Does this mean when I use Qt the ffmpeg libraries are already included? Is there a way for me to access them?

  • Lifetime Qt Champion


    QMediaRecorder take a QMediaObject as parameter. Create your own subclass and provide the adequate controls. You can then generate what you want to record.

  • I've been reading through the different data provided by QMediaObject, and the docs of the objects it provides and so on. It seems to be all metadata - I can't find any point where buffers of image or audio data are provided. Do you know of any examples where a QMediaObject provides synthesized data?

  • Lifetime Qt Champion

    For synthesised data ? No, I don't know any of them.

    However, you can take a look at the various QCamera backneds in Qt sources to see what you need to implement with regards to recording.

Log in to reply