Important: Please read the Qt Code of Conduct -

Extract sound with QMultimedia

  • Hello,

    I would like to know if it is possible to extract sound from a video with qmultimedia.
    I know you can play and record sounds, but how to extract from a video.

    I know how to read video, i know how to write sounds on disk, the only missing part is the extraction.

    Perhaps the answer is : qmultimedia is not built for this, use third party library.

    Thanks in advance,


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Depending on your OS, you could use QAudioProbe.

    Hope it helps

  • @SGaist Thanks for your response.

    As i am running on OSX, i can see that the backend does not support QAudioProbe.

    Qt has a lot of examples for recording sound/videos based on a device, can we substitute a device with a video ?

  • Lifetime Qt Champion

    It's not that easy because both do use the same route.

    You should take a look at QtAV, that might get you the building blocks you need in order to do what you want.

  • @SGaist Thanks again.

    I have already looked at QtAv, but for a commercial purpose QMultimedia is better because it uses codes installed on the target.

  • Lifetime Qt Champion

    Don't take it the wrong way but that's not a good argument.

    OS X applications embed their non-system dependencies so they can run wherever they are installed. That's already what you do with Qt. The only thing you have to take into account with ffmpeg is the codecs you want/need to have. Some are GPL only.

  • @SGaist Allright, thanks for this and no worry i do not take it personnally, i am here to learn :)

    Have you already use ffmpeg bindings of QtAv ? I am trying to use it to run a simple command like : ffmpeg -i input.mp4 output.wav, still trying to figure out the simple way to do this.

    So what are the advantages of using QMultimedia versus QtAv for you ?

    Thanks again and again,


  • Lifetime Qt Champion

    No, I haven't used QtAV yet but ffmpeg libraries directly.

    If you want to just run the ffmpeg executable, then use QProcess.

    QtMultimedia uses the system multimedia framework so you don't have to build additional dependencies. You should also have easy access to the cameras the system can handle as well as reading multimedia files. So depending on your needs, its more than enough.

  • I would like to continue in this discussion. I'm working on a music player and I would like to implement some music visualisation (nothing fancy, just a spectrum analyzer based on FFT).

    So did you find a way to get the raw audio data of a music file I'm currently playing? I'm using QtAV but I didn't find there any possibility to read the decoded audio data or something similar to QAudioProbe.

  • Lifetime Qt Champion


    Then that's something you should ask to the QtAV authors. It's not an official Qt module.