• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Nonsensical values from kAudioFilePropertyBitRate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nonsensical values from kAudioFilePropertyBitRate


  • Subject: Re: Nonsensical values from kAudioFilePropertyBitRate
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 31 Mar 2008 10:42:49 -0700


On 22 Mar '08, at 4:58 PM, I wrote:
kAudioFilePropertyBitRate is returning nonsensical values for some files.
Some VBR MP3 files, such as a 124kbps one encoded by & purchased from eMusic.com, get 32 for this property.

Researched this some more. It's a more serious bug than the simple off-by-1000 one I just mentioned. It only seems to occur with VBR MP3 files, and not with all of them. I was unable to find it with any files encoded by iTunes 7.x, but I did find it in older iTunes-encoded files and with many files encoded with LAME (purchased from eMusic or downloaded as free promos.)

I just filed this as rdar://5831835, enclosing one of the problematic files. Here's the description:

The value of kAudioFilePropertyBitRate, returned from AudioFileGetProperty, is quite incorrect for many (most?) VBR MP3 files. In most cases it's about half what it should be, and I've seen some files where it's off by a factor of 4. This makes this property totally unreliable for purposes like checking whether a file can be successfully streamed over a network connection of known bandwidth. It's actually a lot more accurate to just divide the size of the file by its duration in seconds (which is the workaround I'm using.) [I'm already compensating for the but that MP3 files report their bitrate in kbps, not bps, so the results are a factor of 1000 smaller than for other codecs. I believe this is already a known issue.] * STEPS TO REPRODUCE Insert the following snippet into the sample code PlayFile.cpp (in /Developer/Applications/CoreAudio/), right before the call to AUGraphStart, which is at line 92 in my copy: //BEGIN addition to print bit-rate --Jens Alfke UInt32 bitRate; propsize = sizeof(bitRate); XThrowIfError (AudioFileGetProperty(audioFile, kAudioFilePropertyBitRate, &propsize, &bitRate), "AudioFileGetProperty"); printf("kAudioFilePropertyBitRate: %u\n", bitRate); SInt64 byteCount; propsize = sizeof(byteCount); XThrowIfError (AudioFileGetProperty(audioFile, kAudioFilePropertyAudioDataByteCount, &propsize, &byteCount), "AudioFileGetProperty"); UInt32 estBitRate = round(byteCount*8 / fileDuration / 1024); printf("Actual average bit-rate: %u\n", estBitRate); //END addition to print bit-rate Now build PlayFile and run it on various VBR MP3 files. I've attached one, "Inevitable Fast Access.mp3"; see results below. * RESULTS For some files in my iTunes library: "Inevitable Fast Access.mp3" Encoded by: LAME 3.89 [purchased from eMusic] kAudioFilePropertyBitRate: 32 Actual average bit-rate: 121 According to iTunes: 124 "The Greys.mp3" Encoded by: LAME 3.89 [downloaded free from SXSW festival website] kAudioFilePropertyBitRate: 104 Actual average bit-rate: 210 According to iTunes: 215 "Instrumental Wish.mp3" Encoded by: iTunes 7.0.2 kAudioFilePropertyBitRate: 240 Actual average bit-rate: 157 Reported by iTunes: 160

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Nonsensical values from kAudioFilePropertyBitRate
      • From: james mccartney <email@hidden>
References: 
 >Nonsensical values from kAudioFilePropertyBitRate (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: How to encode with AAC High Efficiency?
  • Next by Date: Re: How to encode with AAC High Efficiency?
  • Previous by thread: Re: Nonsensical values from kAudioFilePropertyBitRate
  • Next by thread: Re: Nonsensical values from kAudioFilePropertyBitRate
  • Index(es):
    • Date
    • Thread