HydrogenAudio

Lossy Audio Compression => AAC => AAC - Tech => Topic started by: guruboolez on 2005-06-21 08:11:26

Title: Could we add gapless to Apple's AAC encoder?
Post by: guruboolez on 2005-06-21 08:11:26
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 (http://www.hydrogenaudio.org/forums/index.php?showtopic=26956&view=findpost&p=307525) and here (http://www.hydrogenaudio.org/forums/index.php?showtopic=26956&st=75&p=240787&#entry240787)). 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?
Title: Could we add gapless to Apple's AAC encoder?
Post by: Otto42 on 2005-06-21 18:25:59
Short answer: no.

Long answer: yes, but I'm not going to add it to iTunesEncode for a number of reasons:

1) iTunesEncode is designed to just be a CLI to access the functionality that iTunes itself provides via the COM interface, with regards to encoding. Other than copying the resulting encoded file around and renaming it, the file itself is never touched by iTunesEncode. It doesn't do anything at all with the actual data in the file, so adding that sort of functionality is beyond the scope of what iTunesEncode currently does.

2) I lost the source code to iTunesEncode via an accident, and so what you get is what there is.  Yeah, I could rewrite the missing pieces easily enough, but there's no real compelling reason to do so at this point. I have already added all the functionality I could feasibly add via the iTunes COM interface. Supposedly, the new iTunes will support VB scripting, which might be advantageous to use in some way, but COM is basically a dead end as far as new functionality goes.

Honestly, it makes more sense to make a new program to modify existing iTunes created AAC files to add that info, sort of thing.
Title: Could we add gapless to Apple's AAC encoder?
Post by: Tropican on 2005-06-21 23:55:10
This may be a dumb question, but if the encoding delay is constant, would it be possible to just add gapless info in the tags with a special MP4 remuxer?  Forgive my ignorance, but to non-coders it seems simpler than I'm sure it is.
Title: Could we add gapless to Apple's AAC encoder?
Post by: nyaochi on 2005-06-22 01:40:36
I don't know much about AAC and MP4 container (I don't even install iTunes on my computer  ), but technically speaking, it should be possible to write such a frontend program for iTunes. We need: 1) encoder delay of iTunes AAC encoder; 2) number of padded silent samples at the end of stream by iTunes (of course it's not constant); and 3) container to store above 1) and 2) information.

As for ACMENC implementation, 1) is supposed to be specified by a user (through a command-line preset); 2) is calculated by the number of samples in an input audio and the number of samples (MP3 frames) in the output MP3 stream. We use MP3-Info frame to store the encoder delay/padding information. To achieve 2), we must count manually the number of frames in the output stream generated by F-IIS ACM codec. We cannot reuse my source code because MP3 and AAC/MP4 are totally different.

I'm not sure how AAC gapless is achieved, but the scenario I guess would be:
1) convert an input audio file into AAC file by iTunes' COM interface;
2) open the input audio file and obtain the number of samples;
3) open and parse the output AAC file to count up the number of frames;
4) construct MP4 stream from the AAC stream and delay/padding information by using libmp4v2(?) similarly to FAAC.

In addition to the general audio-programing knowledge, the knowledge about AAC stream format and MP4 container format will be necessary.
Title: Could we add gapless to Apple's AAC encoder?
Post by: Tropican on 2005-06-22 02:19:33
Quote
We need: 1) encoder delay of iTunes AAC encoder; 2) number of padded silent samples at the end of stream by iTunes (of course it's not constant)
[a href="index.php?act=findpost&pid=307982"][{POST_SNAPBACK}][/a]


How did you find the delay of the FhG encoders nyaochi?  How exactly is an encoder delay determined in any format, or is it format specific?

Removing silent samples has been done so many times in audio editors that it shouldn't be a problem.  Or will removing silent samples that aren't padded ones by iTunes cause even bigger problems?

Quote
I'm not sure how AAC gapless is achieved
[a href="index.php?act=findpost&pid=307982"][{POST_SNAPBACK}][/a]


There's the FAAC source.

Please no developers take this as an insult.  Note that I'm minimizing the amount of work this would take as I'm

1) Not a programmer
2) Someone who really would like to see someone at least attempt to do this, and am worried that the amount of time this would need may scare some talented people away, so is unestimating the time on such a project greatly
3)Am afraid that when iTunes receives VBR support from Quicktime 7, even if the quality ends up being better than Nero, most users here will have to stick with Nero for gapless.


There's always the chance Apple will add support themselves 
Title: Could we add gapless to Apple's AAC encoder?
Post by: nyaochi on 2005-06-22 03:11:32
Quote
How did you find the delay of the FhG encoders nyaochi?  How exactly is an encoder delay determined in any format, or is it format specific?

Lookint at this page (http://mp3decoders.mp3-tech.org/decoders_lame.html) to guess the delay, I measured and confirmed the value by using a wave editor.

Quote
Removing silent samples has been done so many times in audio editors that it shouldn't be a problem.  Or will removing silent samples that aren't padded ones by iTunes cause even bigger problems?

You missed the point. AAC stream seems to have 1024 frame size, which means that you will/must get 1024*n samples after decoding an AAC stream. That's one reason why iTunes must pad silent samples to fill the last frame. And there's another reason from encoder delay, but I don't mention here. Anyway, the necessary task is not removing the silence, but telling a decoder the number of samples to be removed for playback. It cannot be achieved by an audio editor.

Quote
There's the FAAC source.

Please no developers take this as an insult.  Note that I'm minimizing the amount of work this would take as I'm

1) Not a programmer
2) Someone who really would like to see someone at least attempt to do this, and am worried that the amount of time this would need may scare some talented people away, so is unestimating the time on such a project greatly
3)Am afraid that when iTunes receives VBR support from Quicktime 7, even if the quality ends up being better than Nero, most users here will have to stick with Nero for gapless.


There's always the chance Apple will add support themselves 
[a href="index.php?act=findpost&pid=307989"][{POST_SNAPBACK}][/a]

Of course I saw the FAAC source. I understand your feeling to minimize/simplify the problem. But the problem cannot be simplified as you expected. The simplest solution would be something like what I wrote in the previous post, which talented people won't scare.
Title: Could we add gapless to Apple's AAC encoder?
Post by: Tropican on 2005-06-22 04:10:32
Sorry, my last post was poorly written.

Quote
You missed the point. AAC stream seems to have 1024 frame size, which means that you will/must get 1024*n samples after decoding an AAC stream. That's one reason why iTunes must pad silent samples to fill the last frame. And there's another reason from encoder delay, but I don't mention here. Anyway, the necessary task is not removing the silence, but telling a decoder the number of samples to be removed for playback. It cannot be achieved by an audio editor.


I actually didn't miss the point, but used an incredibly bad example.  I was just wondering if we could implement already existing silence cutoff code.  A better example would probably be how some Winamp plugins are able to just cuttoff the silence at the end of a file during decoding, thus achieving gapless playback.  Or isn't that true gapless?

Quote
Of course I saw the FAAC source. I understand your feeling to minimize/simplify the problem. But the problem cannot be simplified as you expected. The simplest solution would be something like what I wrote in the previous post, which talented people won't scare.
[a href="index.php?act=findpost&pid=307999"][{POST_SNAPBACK}][/a]


I didn't doubt you saw the FAAC source, as you specifically mentioned the decoding library used by it and other programs.  I just wanted to make sure others reading this thread knew the information was available.  My mentioning that I was minimizing the problem was just me apologizing in advance, to ensure no one would take offence to what I was saying.  And also talented people may scare if they think that working on this means they themselves must complete it.  Publishing the source of whatever they did would be more than good enough.  If there is enough interest, others are then able to continue.  I think we are putting the cart before the horse though, don't you?  After all, this program will be about as popular and useful as your ACMENC and Otto's iTunesencode.  Not saying they aren't loved here at HA and other select places on the net, but they are no where near large enough to have their development or developers questioned as to who's working on them and their progress.  There really shouldn't be any planning, just us making a thread like this with info, and then down the line if someone ends up working on such an app from what we and hopefully other people write here they can release it to the community.  That was the point I was trying to make, just because there's demand, doesn't mean someone who wants such a feature has to make an awesome program, or even little more than a hack.  I didn't want people to think I was alluding to that.
Title: Could we add gapless to Apple's AAC encoder?
Post by: saratoga on 2005-06-22 05:35:56
Quote
Short answer: no.

Long answer: yes, but I'm not going to add it to iTunesEncode for a number of reasons:

1) iTunesEncode is designed to just be a CLI to access the functionality that iTunes itself provides via the COM interface, with regards to encoding. Other than copying the resulting encoded file around and renaming it, the file itself is never touched by iTunesEncode. It doesn't do anything at all with the actual data in the file, so adding that sort of functionality is beyond the scope of what iTunesEncode currently does.

2) I lost the source code to iTunesEncode via an accident, and so what you get is what there is.  Yeah, I could rewrite the missing pieces easily enough, but there's no real compelling reason to do so at this point. I have already added all the functionality I could feasibly add via the iTunes COM interface. Supposedly, the new iTunes will support VB scripting, which might be advantageous to use in some way, but COM is basically a dead end as far as new functionality goes.

Honestly, it makes more sense to make a new program to modify existing iTunes created AAC files to add that info, sort of thing.
[a href="index.php?act=findpost&pid=307873"][{POST_SNAPBACK}][/a]


How would you get the encoder delay out of iTunes though?  Unless it'll give you the exact sample length of the origonal CD Audio track, I don't see how you could calculate it.
Title: Could we add gapless to Apple's AAC encoder?
Post by: Gabriel on 2005-06-22 08:56:24
Quote
How would you get the encoder delay out of iTunes though?

Delay is usually constant for an encoder, so you can check it manually once, and you are fine.
However to compute padding value, you have to know the original number of samples.
Title: Could we add gapless to Apple's AAC encoder?
Post by: Tropican on 2005-06-22 22:31:07
Quote
you have to know the original number of samples.
[a href="index.php?act=findpost&pid=308041"][{POST_SNAPBACK}][/a]


That's pretty easy then for encoding audio, as you can calculate the number of samples in a .wav.  Just would have to build that into a program.  Right Gabriel?  Sorry, I know little about implementing such a feature.
Title: Could we add gapless to Apple's AAC encoder?
Post by: M on 2005-06-23 02:37:28
Pardon my ignorance on the technicalities involved, but doesn't the MPEG-4 structure allow for chapter stops, or index points of some sort? And if so, wouldn't it be simpler to re-encode an album as a single *.m4a file, with possible plugin or hardware support for using those indices? That would eliminate the entire problem of offsets, calculated or actual, and enable true gapless playback for any player that didn't choke on the metadata. (Yes, I realize this would entail encoding each album as a single, large track, and that it would require players to buffer portions of the track - ideally, to buffer until the next index/chapter marker - but in my end-user/non-programmer/non-hardware-designer/feeble brain the method just makes sense!)

    - M.
Title: Could we add gapless to Apple's AAC encoder?
Post by: Mono on 2005-06-23 04:13:54
Actually that's Apple's official stance:
Quote
Many music CDs contain songs that blend into each other, and importing them to iTunes may create a small gap between songs that interrupts the flow. If you use the iTunes Join Tracks feature, the program melds two or more songs into one, continuous gap-free track. So now you can enjoy listening to classical music, concept rock albums and extended dance mixes without the silent treatment.
Title: Could we add gapless to Apple's AAC encoder?
Post by: westgroveg on 2005-06-23 05:55:21
I think guruboolez needs CASE.
Title: Could we add gapless to Apple's AAC encoder?
Post by: soundcheck on 2005-06-23 06:31:13
Quote
Pardon my ignorance on the technicalities involved, but doesn't the MPEG-4 structure allow for chapter stops, or index points of some sort? And if so, wouldn't it be simpler to re-encode an album as a single *.m4a file, with possible plugin or hardware support for using those indices?
[a href="index.php?act=findpost&pid=308229"][{POST_SNAPBACK}][/a]


Audible is doing exactly what you describe for their audiobooks... large m4a files with chapter stops. It could potentially be used for true gapless albums.

Unfortunately it's still a mystery as to how the feature is implemented...
Title: Could we add gapless to Apple's AAC encoder?
Post by: bond on 2005-06-23 20:20:41
Quote
Quote
Pardon my ignorance on the technicalities involved, but doesn't the MPEG-4 structure allow for chapter stops, or index points of some sort? And if so, wouldn't it be simpler to re-encode an album as a single *.m4a file, with possible plugin or hardware support for using those indices?
[a href="index.php?act=findpost&pid=308229"][{POST_SNAPBACK}][/a]


Audible is doing exactly what you describe for their audiobooks... large m4a files with chapter stops. It could potentially be used for true gapless albums.

Unfortunately it's still a mystery as to how the feature is implemented...
[a href="index.php?act=findpost&pid=308264"][{POST_SNAPBACK}][/a]

do you have such a sample file?
Title: Could we add gapless to Apple's AAC encoder?
Post by: soundcheck on 2005-06-23 23:06:19
Quote
Quote

Audible is doing exactly what you describe for their audiobooks... large m4a files with chapter stops. It could potentially be used for true gapless albums.

Unfortunately it's still a mystery as to how the feature is implemented...
[a href="index.php?act=findpost&pid=308264"][{POST_SNAPBACK}][/a]

do you have such a sample file?
[a href="index.php?act=findpost&pid=308399"][{POST_SNAPBACK}][/a]


Nothing I could legally redistribute.

These Audible files are heavily DRM'ed and can only be played in iTunes, and you're prompted for an Audible login and password when you try to add it to your library.

If one were so inclined, they could always search online for files with extension .aa but they're pretty much useless without an Audible account.
Title: Could we add gapless to Apple's AAC encoder?
Post by: bond on 2005-06-24 09:22:34
Quote
These Audible files are heavily DRM'ed and can only be played in iTunes, and you're prompted for an Audible login and password when you try to add it to your library.

hm could this mean that the .aa files are simply .m4p files using apples drm?

try the following plz:

grab a copy of the mp4box tool and run the following commandline on the .aa file:
MP4Box -info input.aa
and post the output

get mp4box here (http://www.aziendeassociate.it/cd.asp?dir=/gpac)
Title: Could we add gapless to Apple's AAC encoder?
Post by: soundcheck on 2005-06-24 21:00:50
Quote
hm could this mean that the .aa files are simply .m4p files using apples drm?

try the following plz:

grab a copy of the mp4box tool and run the following commandline on the .aa file:
MP4Box -info input.aa
and post the output

get mp4box here (http://www.aziendeassociate.it/cd.asp?dir=/gpac)
[a href="index.php?act=findpost&pid=308516"][{POST_SNAPBACK}][/a]



MP4Box can't open the file -- "extension not supported"...

After renaming the .aa to .mp4:

E:\MP4Box>MP4Box -info test.mp4
Error opening file test.mp4: Invalid IsoMedia File
Title: Could we add gapless to Apple's AAC encoder?
Post by: bond on 2005-06-25 10:09:55
ok so its seems to be indeed a non-mp4 file, thx!
Title: Could we add gapless to Apple's AAC encoder?
Post by: soundcheck on 2005-06-25 18:29:43
Quote
ok so its seems to be indeed a non-mp4 file, thx!
[{POST_SNAPBACK}][/a] (http://index.php?act=findpost&pid=308747")


I think I see what's going on here. It seems that Audible are using a variety of formats. The file I have is directly from Audible.com and uses a proprietary speech-based codec.

However, the Audible files from the iTunes Music Store apparently are AAC and have the same bookmark & chapter-stop features. Check this out:

Quote
2. Audible File Formats

A. Enhanced playback features
Audible utilizes a proprietary file format that includes custom features that improve the user experience over regular MP3 formats when listening to spoken word audio.

Audible files provide the ability to bookmark and remember your last heard position on each and every file stored on the iPod.  You can switch between Audible files, exit and listen to music, and go back and forth and the iPod will remember your last position played and pick up where you left off.

Also, Audible files are broken up into different sections, either by timed intervals, chapters, or program segments. These segment markers allow you to quickly advance backward or forward to the next section.

. . .

Audible files purchased from the iTunes music store are encoded in Apple's AAC format, and provide the same enhanced playback improvements as files with .aa extension downloaded directly from Audible.com.

[a href="http://www.ipodlounge.com/index.php/articles/comments/audible-users-guide-for-ipod/]Audible User's Guide[/url]
Title: Could we add gapless to Apple's AAC encoder?
Post by: bond on 2005-06-25 19:05:11
can you run mp4box's -info on the itunes audible file and post the results plz
Title: Could we add gapless to Apple's AAC encoder?
Post by: M on 2005-06-25 19:13:53
Quote
I think I see what's going on here. It seems that Audible are using a variety of formats. The file I have is directly from Audible.com and uses a proprietary speech-based codec.
[a href="index.php?act=findpost&pid=308831"][{POST_SNAPBACK}][/a]

  Audible uses the ACELP.net codec for many audiobooks. (Before anyone asks, no, I do not have any such files... although perhaps this is what soundcheck has? The bitrate should be in the neighborhood of ~16kbps, if so.) Although the Helix implementation includes ACELP.net encoding, documentation of the *.aa container is almost non-existent. If we could find a way to convert Helix-encoded ACELP audio to iPod-compatible files, that would also be useful.

    - M.
Title: Could we add gapless to Apple's AAC encoder?
Post by: nyaochi on 2005-06-27 03:04:29
Since no one seems to take this task, I read the specification of MP4 file format available from the spec (http://www.iso.org/iso/en/ittf/PubliclyAvailableStandards/c038539_ISO_IEC_14496-12_2004(E).zip), install the latest iTunes on my machine, and download the latest mpeg4ip tools to dump MP4 streams.

I googled and found a thread (http://66.102.9.104/search?q=cache:dXEsvbxESqMJ:www.hydrogenaudio.org/show.php/act/Print/client/printer/f/15/t/16846+ctts+stts+gapless&hl=ja&client=firefox) to implement the gapless solultion (but I found original thread with an important information (http://www.hydrogenaudio.org/forums/index.php?showtopic=16846) later and realized that I shouldn't have taken this approach  ) and implemented a tool to set "ctts" and "stts" MP4 boxes to iTunes' MP4 files (Again, don't take 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: [Select]
      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 (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...  I've gotta sleep.
Title: Could we add gapless to Apple's AAC encoder?
Post by: rjamorim on 2005-06-27 03:57:32
Quote
Does anyone know how to store encoder's delay in an MP4 stream? I'm disappointed to waste my weekend...   I've gotta sleep.[a href="index.php?act=findpost&pid=309133"][{POST_SNAPBACK}][/a]


I think the Nero/Audiocoding guys never bothered to hack into the MP4 container a way to store delay, because both Nero and FAAC have the same delay, and FAAD is compatible with that delay, so it takes it into account automatically when decoding.

If that is correct, you would need to hack a way to store delay in MP4 yourself, and then patch FAAD to take this information into account.

Quote
If so, the encoder delay of FAAC is found to be zero...


Nope, but the encoder/decoder pair delay is zero

If you decoded the FAAC-generated stream in iTunes, you would probably notice some delay.
Title: Could we add gapless to Apple's AAC encoder?
Post by: bond on 2005-06-27 09:59:29
somehow i get the feeling that this "hacking" will not lead to anything good regarding interoperability with normal aac implementations and might break more (cant back this up, just a feeling and experience with private hacks)


therefore i would like to point out that the mp4 container offers explicitely one place where private info of any kind has to be and can be stored and thats the udta (userdata) atom

i would propose to use this for storing private gapless data and make the decoder of your choice (propably faad2) use this data from the udta
Title: Could we add gapless to Apple's AAC encoder?
Post by: nyaochi on 2005-06-27 12:03:37
Thanks for the info, rjamorim and bond 

To summarize the current situation, MPEG-4 specification does not define a field to store encoder's delay. To store the delay value, we must either:
1) Define own field in "udta" MP4 box. Hack FAAD source code to utilize the information. This is straightforward approach to the current situation, but Ivan posted in the thread, "Next revision of nero encoder will have Nero Digital Gapless data embedded in the MP4 file, fully compatible with the ISO File Format guidelines." I'm not a developer of MPEG-4 AAC encoder and don't want to propose another specification while Nero Digital Gapless data is about to be released (or already been released?) by a major MPEG-4 AAC developer. We should avoid such chaotic situation beforehand.

2) Use "edts" MP4 box for this job. Hack FAAD source code to support "edts" MP4 box. I don't think this approach is a good idea because "edts" box seems to aim at stream editing (cutting and combining) and should not be used just for gapless playback.

And another problem is,,, I'm not so MP4/AAC freak.
Title: Could we add gapless to Apple's AAC encoder?
Post by: Tropican on 2005-06-29 02:58:40
Quote
1) but Ivan posted in the thread, "Next revision of nero encoder will have Nero Digital Gapless data embedded in the MP4 file, fully compatible with the ISO File Format guidelines." I'm not a developer of MPEG-4 AAC encoder and don't want to propose another specification while Nero Digital Gapless data is about to be released (or already been released?) by a major MPEG-4 AAC developer.
[a href="index.php?act=findpost&pid=309201"][{POST_SNAPBACK}][/a]


Yes, perhaps it is best to wait.  The really nifty part is since Apple does not seem interested in 'true' gapless then perhaps only Nero's spec will become common in the AAC gapless world, allowing for greater compatibility. 

Very good work nyaochi with your earlier test, I think now it is better understood (at least by me) where we stand on iTunes gapless.
Title: Could we add gapless to Apple's AAC encoder?
Post by: loophole on 2005-06-29 05:04:43
http://www.apple.com/quicktime/tutorials/chaptertracks.html (http://www.apple.com/quicktime/tutorials/chaptertracks.html)

perhaps they are implemented like this, mp4 is heavily based on .mov after all...
Title: Could we add gapless to Apple's AAC encoder?
Post by: Fofer on 2005-07-10 17:04:43
Great info here, looks like this is a great way for TRUE gapless, chaptered playback in iTunes and the iPod:

http://www.dougscripts.com/itunes/index.php#070805b (http://www.dougscripts.com/itunes/index.php#070805b)

http://www.voxmedia.org/wiki/PodcastChapterTool (http://www.voxmedia.org/wiki/PodcastChapterTool)


Now that the ingredients are in place, something tells me a GUI or a script will come out soon that will allow you to insert a CD, choose a menu selection and it will do all the heavy for you.
Title: Could we add gapless to Apple's AAC encoder?
Post by: cvkslashdot on 2005-07-20 01:15:27
Check my tutorial w/ images if you have a mac:

http://gapless.itunes.wanderingfocus.com/ (http://gapless.itunes.wanderingfocus.com/)
Title: Could we add gapless to Apple's AAC encoder?
Post by: Otto42 on 2005-07-20 16:35:04
This isn't really "gapless" as I see it. It's more similar to foobar's CUE file support, kinda. You have the whole album in one file and can set markers at where the tracks are. Yes, you can do gapless with it, but it's still one file and not multiple files.
Title: Could we add gapless to Apple's AAC encoder?
Post by: nyaochi on 2005-07-20 16:49:30
I bet Apple will implement the gapless feature in iTunes and iPod by using Apple Core Audio Format:
http://www.hydrogenaudio.org/forums/index....showtopic=35482 (http://www.hydrogenaudio.org/forums/index.php?showtopic=35482)
http://developer.apple.com/documentation/M...pec/CAFSpec.pdf (http://developer.apple.com/documentation/MusicAudio/Reference/CAFSpec/CAFSpec.pdf)

The specification discusses the gapless playback for at least MP3, AAC, and ALAC by taking an AAC example of encoder delay and the number of samples in a frame. IMHO we should wait for the next major update of iTunes/iPod.
Title: Could we add gapless to Apple's AAC encoder?
Post by: Juho Vähä-Herttua on 2006-05-02 13:56:49
I just implemented true gapless playback of AAC files to XMMS2 using mp4ff from faad project. This thread has been dead for a while but it seems to have a high google rank when searching about gapless AAC so I'll post here what I've learnt.

I think the Nero/Audiocoding guys never bothered to hack into the MP4 container a way to store delay, because both Nero and FAAC have the same delay, and FAAD is compatible with that delay, so it takes it into account automatically when decoding.


This is not true, Nero and FAAC have the delay of 1024 samples which is same as the frame duration they are using and the encoder stores the 1024 offset in ctts sample offset field just correctly. So the most simple way of supporting encoder delay is simply to drop the first frame. What FAAD mp4ff doesn't support very well is decoder delays that are longer than the first frame (it affects total duration of the song in a wrong way at least). I don't know how foobar2000 uses faad and I'm not interested in closed source software in this case.

Is this experimental program mentioned earlier in the thread available somewhere? I could check what I can do but I'm not really interested in manipulating the values manually if there's already some solution available.
Title: Could we add gapless to Apple's AAC encoder?
Post by: e-San on 2011-03-28 09:10:31
I know topic seems to be dead but i am quite shure the problem still exists.

After reading few topics i have some idea.
I use to convert my CD albums to audiobooks to copy it to my iPod. I like it this way.
It is necessery (for me) to add chapters informations to make it usefull for foobar and others.

I use to use linux to do whole this stuff.
I convert audio files with iTunes and some scripting.

I convert each song and then completes all into audiobook.
Ofcourse there are gaps. Quite annoying.

Since i in the end make audiobook i can stick with converting whole album to one wav file and then convert it with iTunes.

iTunes add samples at the beggining and the end of file as Your reserch result.
Since it is not between songs it is not so annoying but i want to add chapters.

My idea to force iTunes to stick with one-lenght silence at the begginig of file is to add proper number of samples at the end of wav file so i can add this information to my chapters file.

What do you think about it?

Best regards!

p.s. by the way. as far as i remember MP4Box (or neroAacEnc) has posibility to DISABLE one of chapters.
it would be posibility to produce mp4 files with iTunes gapless. force iTunes to add constant silence samples at the beggining an the rest at the end. then, mark beggining as chapter and disable it. same for ending.