Get sound from jack with QMediaPlayer or omxplayer system calls?

  • Goodmorning,
    I've downloaded meta-boot2qt and built for Raspberrypi3.
    I'm trying to get audio from raspberry jack output.
    At the current state I can play songs from terminal with "omxplayer -o local music.mp3" getting sound from jack, on the other side with commands like "omxplayer -o alsa " or omxplayer -o hdmi", I get audio from hdmi.
    I succeded to play music with QMediaPlayer (both in c++ or qml), but I'm not able to get it from jack.
    Below the code used in c++:

        QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
        foreach (QAudioDeviceInfo i, devices){
        QMediaPlayer *playMusicObj = new QMediaPlayer();
        QMediaService *svc = playMusicObj->service();
        if (svc != nullptr)
            QAudioOutputSelectorControl *out = qobject_cast<QAudioOutputSelectorControl *>
            if (out != nullptr)

    Whatever devicesName I use, the audio always comes from hdmi.
    I also tested the example multimedia-> audioutput among the qt example code, but the result is the same, the audio always come from hdmi.

    I wonder if omxplayer is the only solution as they did in the following link:

    I'd prefer to stay with QMediaPlayer because it offers much more possibilities than system calls.
    Can you help me?

    Than you for the attention

  • Hi!!

    Did you solve your problem?
    I also met same problem. If you solved it, please share your solutions.


  • Hi @davidino, @Kernel-KIM

    Did you solve your problem?
    I also met same problem.
    I use debian stretch and Qt 5.11. Even after setting up all possible flags on rpi3, I can't get the sound out from the jack in my Qt app. Command line tests play sound through jack....

    AND : If I boot without HDMI cable, sound goes out from jack, even after pluging it into rasp and displaying qt app.

    Thanks !

  • Hello @Kernel-KIM and @etiennedm ,
    no, I haven't solved the problem. In my opinion the only solution that could work is extracting the I2S signal from HDMI, and get the sound from it.
    After all, the raspberry cape use this approach.


Log in to reply