Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: AAC encoded with iTunes: incorrect duration in fb2k (Read 13965 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

AAC encoded with iTunes: incorrect duration in fb2k

foobar2000 shows incorrect duration for several AAC files encoded in iTunes.
I encoded 1-minute WAV files with samplerates: 32 kHz, 44.1 kHz, 48 kHz, and foobar2000 shows the following durations:

AAC-LC encoded files:
for 32000 Hz: 0:43.537 (1393197 samples)
for 44100 Hz: 1:00.000 (2646000 samples)  - the only right value
for 48000 Hz: 1:05.306 (3134694 samples)

HE-AAC encoded files:
for 32000 Hz: 0:21.769 (696599 samples)
for 44100 Hz: 0:30.000 (1323000 samples)
for 48000 Hz: 0:32.653 (1567347 samples)

I use foobar2000 0.9.6.9 and iTunes 9.0.0.70 + QuickTime 7.6.4

AAC encoded with iTunes: incorrect duration in fb2k

Reply #1
I can confirm your finding. I just encoded a bunch of test samples with the latest iTunes Windows version using the AAC-HE, VBR 64 kbps/44.1 KHz setting, and the displayed playback times are only half of what they should be.

Apparently foobar also uses these duration values and ends playback at the displayed time so that half of the files will never be played or converted. (I would need the converter for preparing the samples for ABC/HR Java.)

At least the DC-Bass Source DirectShow filter can decode the same files correctly (I tested this with Media Player Classic)

I am going to try some other decoders and check if the problem exists with them.

 

AAC encoded with iTunes: incorrect duration in fb2k

Reply #2
I've seen some sample files demonstrating this issue and they claim sample rate of 44100Hz in the mp4a atom, which I believe is a bug in Apple's encoder.
Microsoft Windows: We can't script here, this is bat country.

AAC encoded with iTunes: incorrect duration in fb2k

Reply #3
I think you are correct. I tested the Winamp and Nero CL decoders.

Winamp was able to play the files correctly, but its converter created incorrect files. The resulting 44.1 KHz wave files sounded like they were played at double speed (and had only half the original duration).

The Nero decoder behaved like foobar.

EDIT

I uploaded a sample here: http://www.hydrogenaudio.org/forums/index....showtopic=74729

AAC encoded with iTunes: incorrect duration in fb2k

Reply #4
Quote
At least the DC-Bass Source DirectShow filter can decode the same files correctly (I tested this with Media Player Classic)

NeroAacDec.exe (1.3.3.0) has the same problem as foobar2000;
Winamp (5.56+Winamp Essentials 5.55) decodes correctly, but when transcoding iTunes HE-AAC files it drops every other 1024-sample block.
faad2 (2.7)decodes them fully but adds several extra samples (i.e. isn't gapless).

Added: too slow... 

AAC encoded with iTunes: incorrect duration in fb2k

Reply #5
AudioShell 1.3.5 recognizes the duration of iTunes HE-AAC files correctly and they're playing fine in WMP...

AAC encoded with iTunes: incorrect duration in fb2k

Reply #6
I've seen some sample files demonstrating this issue and they claim sample rate of 44100Hz in the mp4a atom, which I believe is a bug in Apple's encoder.


But it's caused by the iTunes gapless data, or do you use that sample rate as scale for that? You should use the track timescale instead. Samplerate in mp4a is better ignored for anything (different mp4 standard versions say different things about it).

AAC encoded with iTunes: incorrect duration in fb2k

Reply #7
But it's caused by the iTunes gapless data, or do you use that sample rate as scale for that? You should use the track timescale instead. Samplerate in mp4a is better ignored for anything (different mp4 standard versions say different things about it).

Yes, this is caused by iTunes gapless data, which I assumed to be measured in samples (which as far as I can tell is still correct). Next version will use audio track timescale instead (which seems valid for all files I've tried so far too). Still, Apple's encoder is writing nonsense to the sample rate field (44100 all the time from what I've seen).
Microsoft Windows: We can't script here, this is bat country.

AAC encoded with iTunes: incorrect duration in fb2k

Reply #8
Yes, this is caused by iTunes gapless data, which I assumed to be measured in samples (which as far as I can tell is still correct).


Hmm, yeah, maybe it is measured in LC AAC samples and not in the track timescale? Then using the track timescale is also not correct, although it would work for these Apple files. I guess I can easily test this, so I'll report back about that.

AAC encoded with iTunes: incorrect duration in fb2k

Reply #9
The timescale for the iTunes gapless data is the LC AAC samplerate as found in the audio specific config. Not very nice for applications that try to keep decoding separated from parsing.

AAC encoded with iTunes: incorrect duration in fb2k

Reply #10
I also tested mp4 container with ALAC (just to be safe). All files were decoded properly regardless of their samplerate, as expected.
But (sorry for offtopic) alac decoding in fb2k is much slower than in ffmpeg or winamp  .

AAC encoded with iTunes: incorrect duration in fb2k

Reply #11
... Next version will use audio track timescale instead ...


Can you give any estimate when the next version will be available?

I really like using foobar2000 for processing, and my JVC head unit will play mp4/m4a AAC files only if they are iTunes encoded.

Thanks

AAC encoded with iTunes: incorrect duration in fb2k

Reply #12
Thanks, the foobar2000 v1.0 beta 1 version released on 2009-11-20 seams to have fixed this issue.