Could we add gapless to Apple's AAC encoder?, task for iTunesencode or other? |
Could we add gapless to Apple's AAC encoder?, task for iTunesencode or other? |
Jun 21 2005, 08:11
Post
#1
|
|
![]() Group: Members (Donating) Posts: 3474 Joined: 7-November 01 From: Strasbourg (France) Member No.: 420 |
I have a question about a possible new iTunesEncode feature (or any other program driving Apple's AAC encoder). Wouldn't it be possible to add a gapless feature? It might sound silly, but after all, nyaochi did it with the latest Fraunhofer MP3 encoder (here and here). I'm not a coding expert -I'm not a coder at all- but I think that doing it wouldn't be an impossible task.
Adding somewhere in the tags the precise offset (constant for Apple's encoder) and calculating the amount of padded sample maybe suffice? I don't really know. faac and Nero AAC are gapless, and apparently Apple is not hurry to implement this feature. It's a pity, because Apple's encoder is pretty good. Gapless playback is not possible on any iPod, but on a computer (playing with foobar2000 as exemple) users would benefits from it. Could we reproduce Nyaochi's ACMenc patch to work with iTunes? Or make something similar? What do you think? |
|
|
|
![]() |
Jun 27 2005, 03:04
Post
#2
|
|
|
Group: Members Posts: 169 Joined: 30-September 01 From: Tokyo, Japan Member No.: 99 |
Since no one seems to take this task, I read the specification of MP4 file format available from the spec, install the latest iTunes on my machine, and download the latest mpeg4ip tools to dump MP4 streams.
I googled and found a thread to implement the gapless solultion (but I found original thread with an important information later and realized that I shouldn't have taken this approach I measured iTunes’ encoder delay and found it to be probably 1088 (= 1024+64?). Then I modify the MP4 stream to store gapless-playback information. The following is an example of a dump text of an MP4 stream my experimental program generated: CODE type stts version = 0 (0x00) flags = 0 (0x000000) entryCount = 2 (0x00000002) sampleCount = 431 (0x000001af) sampleDelta = 1024 (0x00000400) sampleCount[1] = 1 (0x00000001) sampleDelta[1] = 744 (0x000002e8) type ctts version = 0 (0x00) flags = 0 (0x000000) entryCount = 2 (0x00000002) sampleCount = 1 (0x00000001) sampleOffset = 1088 (0x00000440) sampleCount[1] = 431 (0x000001af) sampleOffset[1] = 0 (0x00000000) RESULT: In a short answer, I could not get gapless playback/decoding by using foobar2000/faad. Even though foobar2000 displays the song length as I expected: 01-itunes-1088.m4a: 441000 (= 431 * 1024 + 744 -1088) 01-itunes.m4a: 442368 (= 432 * 1024) foobar2000 and faad won’t remove samples at the beginning which comes from the encoder delay of iTunes’ AAC encoder. REASON FOR FAILURE: I found a post saying, "don't use 'ctts' and 'stts' boxes for gapless playback", in the original HA thread which does not exist in the Google's cache. Now I realized the reason why foobar and faad did not implement "ctts" for removing samples at the beginning. HOW GAPLESS PLAYBACK IS ACHIEVED IN FAAC: I have no idea how faac implements gapless playback. To remove the padded samples, we can use duration field in 'mdhd' MP4 box instead of 'stts'. But I was wondering how the decoder removed the samples which comes from FAAC encoder's delay. Then I compared the wave forms of: original wave; iTunes (delay = 1024; this is only for debugging purpose); iTunes (delay = 1088); iTunes (no delay information); faac (MP4 stream); and faac (AAC stream) in this order: http://nyaochi.sakura.ne.jp/temp/mp4-delay.png All streams made from iTunes have the same delay even though I added delay information. Another interesting thing is, AAC stream does not have any delay. AFAIK, AAC stream does not contain gapless playback information, right? If so, the encoder delay of FAAC is found to be zero... In conclusion, I could find a solution to remove padded samples, but no solution for removing samples at the beginning of a track that comes from encoder's delay. Does anyone know how to store encoder's delay in an MP4 stream? I'm disappointed to waste my weekend... |
|
|
|
guruboolez Could we add gapless to Apple's AAC encoder? Jun 21 2005, 08:11
Otto42 Short answer: no.
Long answer: yes, but I'm n... Jun 21 2005, 18:25
Mike Giacomelli QUOTE (Otto42 @ Jun 21 2005, 09:25 AM)Short a... Jun 22 2005, 05:35
Gabriel QUOTE How would you get the encoder delay out of i... Jun 22 2005, 08:56
Tropican This may be a dumb question, but if the encoding d... Jun 21 2005, 23:55
nyaochi I don't know much about AAC and MP4 container ... Jun 22 2005, 01:40
Tropican QUOTE (nyaochi @ Jun 21 2005, 07:40 PM)We nee... Jun 22 2005, 02:19
nyaochi QUOTE (Tropican @ Jun 22 2005, 10:19 AM)How d... Jun 22 2005, 03:11
Tropican Sorry, my last post was poorly written.
QUOTE (ny... Jun 22 2005, 04:10
Tropican QUOTE (Gabriel @ Jun 22 2005, 02:56 AM)you ha... Jun 22 2005, 22:31
M Pardon my ignorance on the technicalities involved... Jun 23 2005, 02:37
soundcheck QUOTE (M @ Jun 22 2005, 09:37 PM)Pardon my ig... Jun 23 2005, 06:31
bond QUOTE (soundcheck @ Jun 23 2005, 07:31 AM)QUO... Jun 23 2005, 20:20
soundcheck QUOTE (bond @ Jun 23 2005, 03:20 PM)QUOTE (so... Jun 23 2005, 23:06
bond QUOTE (soundcheck @ Jun 24 2005, 12:06 AM)The... Jun 24 2005, 09:22
soundcheck QUOTE (bond @ Jun 24 2005, 04:22 AM)hm could ... Jun 24 2005, 21:00
Mono Actually that's Apple's official stance:
Q... Jun 23 2005, 04:13
westgroveg I think guruboolez needs CASE. Jun 23 2005, 05:55
bond ok so its seems to be indeed a non-mp4 file, thx... Jun 25 2005, 10:09
soundcheck QUOTE (bond @ Jun 25 2005, 05:09 AM)ok so its... Jun 25 2005, 18:29
M QUOTE (soundcheck @ Jun 25 2005, 12:29 PM)I t... Jun 25 2005, 19:13
bond can you run mp4box's -info on the itunes audib... Jun 25 2005, 19:05
rjamorim QUOTE (nyaochi @ Jun 26 2005, 11:04 PM)Does a... Jun 27 2005, 03:57
Juho Vähä-Herttua I just implemented true gapless playback of AAC fi... May 2 2006, 13:56
bond somehow i get the feeling that this "hacking... Jun 27 2005, 09:59
nyaochi Thanks for the info, rjamorim and bond
To summa... Jun 27 2005, 12:03
Tropican QUOTE (nyaochi @ Jun 27 2005, 06:03 AM)1) but... Jun 29 2005, 02:58
loophole http://www.apple.com/quicktime/tutorials/chaptertr... Jun 29 2005, 05:04
Fofer Great info here, looks like this is a great way fo... Jul 10 2005, 17:04
cvkslashdot Check my tutorial w/ images if you have a mac:
ht... Jul 20 2005, 01:15
Otto42 This isn't really "gapless" as I see... Jul 20 2005, 16:35
nyaochi I bet Apple will implement the gapless feature in ... Jul 20 2005, 16:49
e-San I know topic seems to be dead but i am quite shure... Mar 28 2011, 09:10![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd May 2013 - 08:48 |