IPB

Welcome Guest ( Log In | Register )

HE-AAC gapless playback
nu774
post Dec 22 2012, 17:36
Post #1





Group: Developer
Posts: 476
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:
  1. Append silence of 2048 samples to the end of input before sending to encoder
  2. Add 481 to encoder delay of iTunSMPB, and also edit other values

Using this hacked version of qaac, now I could get gapless HE-AAC playback on fb2k.
So, my guess is the following:
  1. fb2k doesn't trim additional decoder delay introduced by SBR tool
  2. Winamp FhG encoder count this additional decoder delay into encoder delay of iTuneSMPB

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.
Attached File  HE_AAC_Gapless.zip ( 1.26MB ) Number of downloads: 142


This post has been edited by nu774: Dec 22 2012, 18:25
Go to the top of the page
+Quote Post
 
Start new topic
Replies
benski
post Dec 22 2012, 20:06
Post #2


Winamp Developer


Group: Developer
Posts: 669
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.
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 19th April 2014 - 11:08