HE-AAC gapless playback |
![]() ![]() |
HE-AAC gapless playback |
Dec 22 2012, 17:36
Post
#1
|
|
![]() Group: Developer Posts: 295 Joined: 22-November 10 From: Japan Member No.: 85902 |
I knew that Apple and other software (at least fb2k and winamp FhG encoder) treats delay of HE-AAC differently.
In short, fb2k can play FhG's HE-AAC gaplessly, and iTunes can play Apple's HE-AAC gaplessly, but fb2k cannot play Apple's HE-AAC gaplessly, etc. Personally I'm not using HE-AAC for music so I didn't care much about it so far. However, just out of curiosity, I looked into it further today. In ISO 14496-24:2008 (which you can read from the link at http://wiki.multimedia.cx/index.php?title=AAC), it is written that additional decoder delay introduced by SBR tool is 481 (which becomes 962 in upsampled scale). Then I tried trimming the first 962 samples of the decoded wav file (encoded by Apple then decoded by fb2k), and I noticed that offset matches with the original. Next, I made hacked version of qaac, which basically do the following:
Using this hacked version of qaac, now I could get gapless HE-AAC playback on fb2k. So, my guess is the following:
Why all of this is happening? Is this correct? This hacked qaac and used test files are in the attached file: Files under CAF and M4A_2112 are unmodified HE-AAC files (You can play this CAF file gaplessly using my foo_input_caf). Files under M4A_2112+481 was encoded using hacked qaac.
HE_AAC_Gapless.zip ( 1.26MB )
Number of downloads: 49This post has been edited by nu774: Dec 22 2012, 18:25 |
|
|
|
Dec 22 2012, 18:11
Post
#2
|
|
![]() Group: Developer Posts: 295 Joined: 22-November 10 From: Japan Member No.: 85902 |
As I did it, trimming required by gapless playback can be achieved by counting this as the encoder delay (Although it is some kind of a hack or cheating).
However, I think it is quite problematic if it actually is a decoder delay produced by SBR decoding, since HE-AAC can be decoded as LC-AAC (ignoring SBR part), in which case this additional delay will not appear. |
|
|
|
Dec 22 2012, 20:06
Post
#3
|
|
|
Winamp Developer Group: Developer Posts: 662 Joined: 17-July 05 From: Ashburn, VA Member No.: 23375 |
The Winamp code for adding the iTunSMPB writes the total encoder+decoder delay, yes. And the playback code also assumes that iTunSMPB includes total delay. That's what was done for iTunes AAC LC, but I have not updated this code since iTunes added support for HE-AAC.
I will investigate the iTunes implementation and see what delay is written and whether it includes SBR delay or not. It does raise the question of what to do about old files with the wrong delay value, but since the delays are fairly standard it can be easily detected and corrected for. Thanks for passing along the information; wouldn't have known about it otherwise. |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 21st May 2013 - 12:47 |