Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtMultimedia record sound and save as MP3
QtWS25 Last Chance

QtMultimedia record sound and save as MP3

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 8.3k 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.
  • G Offline
    G Offline
    goocreations
    wrote on last edited by
    #1

    Ok, I managed to to record sound as raw PCM data and play it back again using QAudioInput and QAudioOutput.
    However I didn't manage (and can't find anything online) to save this data as MP3, WMA, etc. The example shown in the docs ("http://developer.qt.nokia.com/doc/qt-4.8/qaudioinput.html":http://developer.qt.nokia.com/doc/qt-4.8/qaudioinput.html) saves the data as PCM data. When I run QAudioDeviceInfo::supportedCodecs() it only returns the PCM codec.

    Is there any way to export or convert the pcm to MP3, WMA, WAV, etc?

    Thanks

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goocreations
      wrote on last edited by
      #2

      I've noticed this is possible with QMediaRecorder. However I have to process (spectrum analysis, etc) the data first, so I don't think QMediaRecorder is an option.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aureshinite
        wrote on last edited by
        #3

        bq. Is there any way to export or convert the pcm to MP3, WMA, WAV, etc?

        WAV is a specific PCM format. For MP3 and WMA, you need an audio codec which use the PCM data you have created. I don't know if Qt has some builtin codecs, but you can get a MP3 decoding library and just plug it in. Try "mpg123":http://www.mpg123.de/ for example.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goocreations
          wrote on last edited by
          #4

          Yes, as far as I know there are no MP3, etc codecs in Qt. But I don't really want to use external libraries, since it complicates things and I want to port my app to all kinds of systems. So I though if someone didn't write a few Qt classes to support these formats that I can just add to my app.

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            try looking at how VLC guys do this, maybe it would help. VLC is cross-platform and bundles it's own codecs.

            (Z(:^

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goocreations
              wrote on last edited by
              #6

              Thanks, is VLC generic enough to use on mobile and embedded devices?

              1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                no idea. Probably yes.

                (Z(:^

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goocreations
                  wrote on last edited by
                  #8

                  Ok, thanks. I'll have a look into that.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goocreations
                    wrote on last edited by
                    #9

                    Does anyone know if there are any plans from Qt's side to someday add additional codecs, or would it make Qt too specific (non-generic)?

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      aureshinite
                      wrote on last edited by
                      #10

                      I had my application doing the exact opposite of yours, which was reading AAC audio and process it in some way. I found a 3rd party library, tested it on the Mac, Windows, and Linux and used with Qt. Plus, there are lot of applications out there which need to run on dedicated devices, so I expect libraries compatible with these devices to exist.
                      If the trolls add a codec, it will be one already done by a third party, that will be tested and validated. Don't expect the Qt developers to reinvent the wheel.

                      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