0

I am using AVAudioPlayer to stream and playback MP3 audio, and would like to obtain the bit rate of the MP3 audio. There is a "settings" property of AVAudioPlayer in which there is a key "AVEncoderBitRateKey" identifying the audio bit rate. However, the value of bit rate I saw from AVEncoderBitRateKey is 0 (AVEncoderBitRateKey = 0). Is there something wrong? I can see the sample rate with the key AVSampleRateKey though (e.g. AVSampleRateKey = 32000).

So how can I obtain the MP3 bit rate programmatically in iOS? Thanks in advance.

stspb
  • 193
  • 2
  • 12
  • Does this happen with every file, or only certain ones? Always MP3, or even with another codec like AAC? I've had success reading this key before, so we need to try and narrow down where your error may be. – Ric Perrott May 20 '13 at 16:49
  • All my audio are MP3 files.I tried 3 files and I cannot read the bit rate with AVEncoderBitRateKey from any of them. The bit rates read with AVEncoderBitRateKey are all 0s. Thanks. – stspb May 20 '13 at 17:07
  • Thanks Hughes. Were they all encoded with the same encoder by chance? Perhaps it's a form of VBR that the AVAudioPlayer has trouble analyzing? – Ric Perrott May 21 '13 at 13:18

0 Answers0