Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to play mp3 file
Forum Update on Monday, May 27th 2025

How to play mp3 file

Scheduled Pinned Locked Moved Mobile and Embedded
12 Posts 2 Posters 7.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _Mark_
    wrote on last edited by
    #1

    In order to play mp3 files with QAudioOutput what should I install?
    Currently only wav files are played.

    I'm talking about a linux embedded environment. I cannot find in the doc which libraries it needs. I tried to install gstreamer 0.1 but it doesn't work.

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      With Qt 4, you need to use a 3rd party library to decode your MP3 files into raw PCM format. Once you have your audio in PCM format, you can pass it into QAudioOutput. Try http://www.mpg123.de/

      Or, if you use Qt 5, QMediaPlayer can play MP3 files directly on Linux. All you need to do is install codecs on your system.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • _ Offline
        _ Offline
        _Mark_
        wrote on last edited by
        #3

        Hello,
        I'm using Qt5.2 and I've already have installed mpg123.

        Whenever I try to play anything with QMediaPlayer I got the following warning and no audio:

        @
        defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
        @

        Perhaps I miss something but I can't figure out...

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          What distro are you using? How did you install Qt 5?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • _ Offline
            _ Offline
            _Mark_
            wrote on last edited by
            #5

            I compiled a custom buildroot image.
            Where might I find what QtMediaPlayer requires in order to work?

            1 Reply Last reply
            0
            • JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              Did you build Qt 5 yourself too?

              QMediaPlayer uses GStreamer 0.1 as the audio backend on Linux. You need to install GStreamer dev libraries, with the relevant GStreamer plugins for decoding MP3 data.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              0
              • _ Offline
                _ Offline
                _Mark_
                wrote on last edited by
                #7

                Buildroot compiled Qt5 for me ;-)
                I included gstremer libraries but I'm afraid not the -dev ones. I will double check for this.

                1 Reply Last reply
                0
                • _ Offline
                  _ Offline
                  _Mark_
                  wrote on last edited by
                  #8

                  I can't find the correct package in buildroot to enable the support for QMediaPlayer!

                  1 Reply Last reply
                  0
                  • JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on last edited by
                    #9

                    Where did you get your custom buildroot from?

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    1 Reply Last reply
                    0
                    • _ Offline
                      _ Offline
                      _Mark_
                      wrote on last edited by
                      #10

                      git clone git://git.buildroot.net/buildroot

                      and then I configured it using make nconfig.
                      Do you know what package(s) I need to add?

                      1 Reply Last reply
                      0
                      • JKSHJ Offline
                        JKSHJ Offline
                        JKSH
                        Moderators
                        wrote on last edited by
                        #11

                        Looks like a neat project. I've never seen it or used it before unfortunately, so I don't have an exact solution.

                        But in general. you need GStreamer 0.1, plus a GStreamer MP3 decoding plugin. You need to make sure GStreamer (the dev libraries) is installed BEFORE you compile Qt.

                        If you need more help, perhaps the Buildroot developers/community know more details.

                        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                        1 Reply Last reply
                        0
                        • _ Offline
                          _ Offline
                          _Mark_
                          wrote on last edited by
                          #12

                          I've already written to the buildroot mailing list - still no answers on this topic. Thank you anyway,

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved