I want to display the bitrate of existing MP3 files and AAC files to the user, but I don't know how to correctly extract the bitrate of these files.
So far, I've tried to get the AudioConverterRef
pointer of the ExtAudioFileRef
and then I wanted to get the bitrate out of the converter, but my problem starts already in the first step. I get NULL
for the kExtAudioFileProperty_AudioConverter
property:
OSStatus status;
AudioConverterRef result = NULL;
UInt32 size = sizeof(result);
status = ExtAudioFileGetProperty(fileRef, kExtAudioFileProperty_AudioConverter, &size, &result);
assert(status == noErr);
assert(result != NULL); // here it fails
I can read the AudioStreamBasicDescription
from the same fileRef
successfully, so the fileRef
is fine.
How to get the bitrate of compressed audio files?