Help - Search - Members - Calendar
Full Version: Patching sample rate in AAC files?
Hydrogenaudio Forums > Lossy Audio Compression > AAC > AAC - Tech
Donut
Hi,

My personal audio player seems to have a little bug: stereo (HE-)AAC files play fine, but mono ones play at double the correct speed!

I'm using ISO AAC files, not MPEG-4. I can think of two workarounds for this:
1. Before encoding, convert the source mono WAV file to stereo, where both channels are exactly the same, and create a stereo AAC file where both channels are the same (if that's possible). That would probably result in larger AAC files.
2. After encoding, patch the sampling rate specified in the AAC file to half the actual rate, e.g. to 22050Hz in the case of 44.1kHz audio. Then the player will hopefully play the mono file at the correct speed.

I'd like to experiment with the second workaround. Is the sampling rate specified at only one point in an ISO AAC file? Or is it repeated in every audio frame (or whatever the correct term is)? If the former, where can I get info on the AAC file header layout, apart from the (expensive) ISO standard document?


-- M
Garf
(1) Would work fine. The encoders are generally "smart" enough to figure that L=R and spend almost 0 bytes encoding the extra channel.

Samplerate is speficied in the header for each frame (ADTS), or once for the whole file (ADIF, MP4). ADIF and ADTS descriptions are findable on the net.
Donut
QUOTE(Garf @ May 13 2005, 06:31 AM)
(1) Would work fine. The encoders are generally "smart" enough to figure that L=R and spend almost 0 bytes encoding the extra channel.

Samplerate is speficied in the header for each frame (ADTS), or once for the whole file (ADIF, MP4). ADIF and ADTS descriptions are findable on the net.


Thanks. I found some info about ADIF and ADTS on the audiocoding.com wiki.

Are there any free tools to convert ADTS<->ADIF (or ADTS->MP4 and MP4->ADIF)? Or to convert ADTS to a raw headerless stream? Apart from curiosity to see whether my player works with ADIF files, they are smaller than ADTS.

If I can convert ADTS to ADIF, then I can easily patch the sampling rate in the header of mono files. (Useful if I only have a mono AAC file and no access to the uncompressed source - and no desire to write a program to parse an entire ADTS file changing the frame headers.)


-- M
SebastianG
You might run into troubles if you change the sampling rate. AAC makes use of a sampling rate specific partition of the spectrum into scalefactor bands. Changing the sampling rate could render the AAC stream useless (I'm not 100% sure).

The best option seems to be to transcode your file from mono to stereo. In theory this could be done losslessly. But there's probably no software yet able to do this.

Sebi
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.