Search code examples
qtbitrateaudioformat

How to get bitrate for audio file in QT?


Looks like i'm missing something, but I can't figure out how to get bitrate of mp3 file in Qt. I checked QAudioFormat for channels, but still no bitrate value. Correct me if I mistaken, thanks.


Solution

  • http://doc.qt.io/qt-5/qmediaresource.html#details QMediaResource includes information such as the MIME type, audio and video codecs, audio and video bit rates, and resolution so these constraints and others can be evaluated.

    int QMediaResource::audioBitRate() const

    Returns the bit rate in bits per second of a media resource's audio stream.

    Hope this helps.