Skip to main content

Topic: iTunes 4 and VBR AAC encoding (Read 18608 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • blessingx
  • [*][*][*][*]
iTunes 4 and VBR AAC encoding
AAC codec builds upon state-of-the art signal processing technology from Dolby Laboratories and brings true variable bit rate (VBR) audio encoding to QuickTime.

The encoding settings in iTunes doesn't list VBR options. Now if all AAC encoding rates are VBR (are they?) what do the bitrates mean? Guaranteed minimums? Rough middle ground? Never quite understood previous iTunes mp3 VBR settings either. Unlike LAME encoding which made much more sense (and was documented). Anyone have any ideas about the mp4 settings?

iTunes 4 and VBR AAC encoding
Reply #1
Quote
AAC codec builds upon state-of-the art signal processing technology from Dolby Laboratories and brings true variable bit rate (VBR) audio encoding to QuickTime.

The encoding settings in iTunes doesn't list VBR options.

QuickTime is not the same as iTunes... 

Quote
Now if all AAC encoding rates are VBR (are they?) what do the bitrates mean? Guaranteed minimums? Rough middle ground? Never quite understood previous iTunes mp3 VBR settings either. Unlike LAME encoding which made much more sense (and was documented). Anyone have any ideas about the mp4 settings?


It's a bit difficult to clear up what Apple means and knows or wants to tell about CBR and VBR and/or ABR in their applications. To start from the top: the MP4 container that is used in QuickTime 6 Pro understands VBR. This is documented in a comprehensive paper about the new features of QuickTime 6. This may be the reason why you often find statements that QuickTime uses VBR for AAC encodings. As far as I know, the Dolby AAC codec inside QT does not use VBR, but rather CBR with its usual bit reservoir, so there is a small headroom for variations of the bitrate. Maybe you should test it yourself with two different WAVs/AIFFs that you know are completely opposite in sound and resulting bitrates. If you get almost the same file size afterwards, QT 6 uses CBR.

What they've decided to do in iTunes4 now isn't clear yet, but probably they use the same Dolby codec. The resulting *.m4a file is a simple MPEG-4 AAC LC file, by the way (thanks, Menno), so you can just rename them to *.mp4 and look for the header infos with an appropriate player (Winamp or foobar2000). Keep in mind that these might not be the truth, though... 
  • Last Edit: 30 April, 2003, 03:29:23 AM by hans-jürgen
myspace.com/bluezzbastardzz
myspace.com/indigorocks

  • blessingx
  • [*][*][*][*]
iTunes 4 and VBR AAC encoding
Reply #2
Quote
Maybe you should test it yourself with two different WAVs/AIFFs that you know are completely opposite in sound and resulting bitrates. If you get almost the same file size afterwards, QT 6 uses CBR.

Okay. I tested the following-

Velvet Underground's Beginning To See The Light, off of the 1969 Live Album Vol1. Time- 5:32:??
Chet Baker's Moon & Sand, off Let's Get Lost soundtrack. Time- 5:32:??

Encoded at 224kps aac in iTunes 4. Guess it's CBR. Files sizes are almost exactly the same.

Light- 9,382,960 bytes
Sand- 9,386,822 bytes.

  • blessingx
  • [*][*][*][*]
iTunes 4 and VBR AAC encoding
Reply #3
Another test for this whole VBR question. I just recorded 5:32 of silence to a wav/aiff, burned to a CD-RW, then encoded to 224 kps mp4. Byte count is 9,382,203, nearly identical to both earlier tracks.

iTunes 4 and VBR AAC encoding
Reply #4
Quote
Another test for this whole VBR question. I just recorded 5:32 of silence to a wav/aiff, burned to a CD-RW, then encoded to 224 kps mp4. Byte count is 9,382,203, nearly identical to both earlier tracks.

Thanks for testing, so now we know it for sure...    By the way, I read today on the 3ivx forum that there has been a huge increase in encoding speed from QuickTime 6.1 to 6.2 (not available for Windows at the moment) which probably uses the same codec as iTunes4 now. This could be another reason for the reported sound problems on the Apple forums with the downloaded Music Store files at 128 kbps.

Another interesting fact is that *.m4a files encoded with iTunes4 can be played back with the Windows Media Player using the freeware 3ivx DS filter with no further modifications, not even renaming them to *.mp4. See this thread:

http://forums.3ivx.com/cgi-bin/ikonboard/t...rum=15&topic=19
myspace.com/bluezzbastardzz
myspace.com/indigorocks

  • brett
  • [*]
iTunes 4 and VBR AAC encoding
Reply #5
nice find hans -- thanks

iTunes 4 and VBR AAC encoding
Reply #6
I did some testing myself, and files of the same length come out the same size. However, if you get the properties of the sound track in QuickTime, it says the files are variable bitrate. Is this some sort of average bitrate thing that just happens to come out to exactly the right size every time? That's a neat trick if it is.

  • Ivan Dimkovic
  • [*][*][*][*][*]
  • Developer
iTunes 4 and VBR AAC encoding
Reply #7
AAC is always variable bit rate with following rules:

1.  Maximum number of bits per one frame is in range from 0 to 6144, multiplied by the number of channels

2.  If encoder uses bit reservoir of exactly specified and defined size (by formulae in the standard), approx 10000 bits for 128 kbps, 44.1 kHz, Stereo - in that case, encoded stream is CBR  and it follows the ISO 13818-7/14496-3 buffer guidelines.

3.  If encoder uses bit reservoir of 0 bits (no bit reservoir), in that case  files are perfect CBR and this is used only in LD (Low Delay) AAC to minimize pre-buffering delay when decoding of streamed content.  Not recommended in any way except for the said application (two-way low delay communication)..

4.  If encoder uses much bigger bit reservoir than one defined by the standard  in that case it is ABR

5.  If encoder does not care about bit reservoir and encodes only according to the psychoacoustic rules it is VBR


Usual methods are 2 and 5  and in some cases 4

iTunes 4 and VBR AAC encoding
Reply #8
Thanks for the info. My understanding of audio codecs becomes less imperfect every day. So I'm guessing Apple's using option 2?

  • Ivan Dimkovic
  • [*][*][*][*][*]
  • Developer
iTunes 4 and VBR AAC encoding
Reply #9
Well,  while I played with conversion of Dolby AAC files to MP4 format  - I remember that it followed buffer guideliness, so it is option #2

I should check if for "VBR" (as they call it) they use bigger bit reservoir, but I am not sure.

  • neomoe
  • [*][*][*][*]
iTunes 4 and VBR AAC encoding
Reply #10
hi!

I've made some screenshots from foobar while itunes-encoded (192kbps) m4as were playing. the bitrate goes sometimes down to ~140 and sometimes up to ~270 kbps.

shot a:



shot b:



regards!
  • Last Edit: 24 February, 2004, 07:11:20 AM by neomoe

  • XXX
  • [*]
  • Banned
iTunes 4 and VBR AAC encoding
Reply #11
While they will go up and down, all aac files I've seen do.  But they do this at the start only; after a second or two they settle down to 128 or real close.  Not quite a x-file.

  • neomoe
  • [*][*][*][*]
iTunes 4 and VBR AAC encoding
Reply #12
well, that's not true, i guess..
try it and you'll find that this happens during the whole file.

  • Ivan Dimkovic
  • [*][*][*][*][*]
  • Developer
iTunes 4 and VBR AAC encoding
Reply #13
At 128 kb/s, 44.1 kHz, Stereo  AAC by standard has bit reservoir of some 10000 bits,  1 stereo frame is somewhat near 3000 bits - so you can do your math: bit rate could fluctate in following way:

bit rate < 3000  --- bit reservoir is being filled
bit rate > 3000  --- bit reservoir is being drained
bit rate = 3000  --- bit reservoir stays intact (*)

(*) 3000 is not exact value, but I am too lazy to calculate it now

Some engineers claim that this bit reservoir size is usually enough to handle music PE variations under normal circumstance (no worst case items, codec killers, etc...) - however this is matter of personal judgment under careful listening tests.

Nero AAC "CBR" uses same allocation - however with VBR, bit reservoir is just unlimited.

  • XXX
  • [*]
  • Banned
iTunes 4 and VBR AAC encoding
Reply #14
Quote
well, that's not true, i guess..
try it and you'll find that this happens during the whole file.

You don't sound too convinced.  When I said first second, I meant first 10 seconds or so, obviously, which everyone should have known.  I only know about iTunes music store files.  Are there others?  For example, Toxic has 2 frames under 64 kbps, 1 under 80, 2 under 112, 1000s under 128 kbps, 146 (frames) under 160, and 2 under 192 kbps.  Those not right around 128 kbps happened within the first 10 seconds.  The actual low was 11 kbps (you see a few of those at the very start) and the high was 189 kbps, but in the end ... waiting for it to end, out of

8565 frames

8411 were right around 128 kbps

and all that weren't happened in the first 10 seconds.

8535 frames used m/s (99%), and 886  (10%) used tns (hard to imagine since it's sooo LOUD, way over the limit).  I used Toxic as an example.  Please do not try this at home.  I am a skilled daredevil and because I listened and survived does not mean you will.

  • neomoe
  • [*][*][*][*]
iTunes 4 and VBR AAC encoding
Reply #15
i'm actually very convinced!
but, i meant files, which i encoded on my own with iTunes 4.2.
proof it yourself.

  • XXX
  • [*]
  • Banned
iTunes 4 and VBR AAC encoding
Reply #16
Quote
i'm actually very convinced!
but, i meant files, which i encoded on my own with iTunes 4.2.
proof it yourself.

For your pleasure, I have.  Metallica has been encoded in 4.2 and I hear Lars complaining about me pirating already (who let him on here?).  In the first FEW seconds, there were frames from 11 to 190 kbps, but after that it settled to 128.  In the end there are ... wait.  It's the same story as last time (tune's too long).  If you think it only happens at 192, I could check but I don't use Aac at 192.  (later) Since I am doing 192 I can tell you the results at 128 since it's done.

14282 frames

Of those
2 are under 64,
1 is under 80,...
2 under 112,
14154 around 128 (+/- 2 kbps),
120 (frames) under 160,
and 2 under 192.

Other ranges didn't apply.

The 192 is done encoding.  Same story.  Low is 29 and high is 298 kbps (actually measures, not mp4 box numbers).

1 under 64,
1 under 80,
1 around 128,
14108 frames at 192,
and 170 over 192.

All those not around 192 happened in the first few seconds.

This is iTunes 4.2.0.72.  No "VBR" in the classic sense here.

... waiting for it to end so I can write the frames at 192...hold on.  Done (14108 at 192, or 98.8 % of them).

  • neomoe
  • [*][*][*][*]
iTunes 4 and VBR AAC encoding
Reply #17
Quote
This is iTunes 4.2.0.72. No "VBR" in the classic sense here.


never said, iTunes produced VBR files..

but, ok, i'm convinced for now. i did not look that close to the files, just noticed a variation of the bitrate... 
though the results are surprising. if ypu play those files back in foobar bitrate looks really very varying.. hrmm..

  • buzzy
  • [*][*][*]
iTunes 4 and VBR AAC encoding
Reply #18
It might be interesting to do this analysis on an encode of some tracks with more variation in the music than the 2 you picked; and using iTunes 4.5

  • Ivan Dimkovic
  • [*][*][*][*][*]
  • Developer
iTunes 4 and VBR AAC encoding
Reply #19
That method is doomed do fail - even in "CBR" mode, AAC allows free frame size, as long as you do not violate buffer requirements - so with particular signal you could have frames ranging anywhere between 4 and 512 kb/s

Best way to test is just encoding silence - if the file is still 128 kb/s  with fill bits, it is using reservoir and not the "true" VBR in LAME/MPC/Ogg VBR sense.

  • buzzy
  • [*][*][*]
iTunes 4 and VBR AAC encoding
Reply #20
Though I'm not sure the question is necessarily whether it's true VBR.  A strong ABR implementation might do for most stuff.

Has anyone determined the size of the bit reservoir in 4.5?  Searches don't turn up any answer.

Someone did do some tests on music with silence ...
http://www.hydrogenaudio.org/forums/index....showtopic=21814
  • Last Edit: 07 June, 2004, 09:30:15 AM by buzzy