HydrogenAudio

Lossy Audio Compression => AAC => AAC - General => Topic started by: CyberInferno on 2003-10-25 11:31:04

Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: CyberInferno on 2003-10-25 11:31:04
NOTE MENNO'S WARNING: "This method completely removes the possibility to gapless playback in Nero and other FAAD2 based players."  This process should be used as a temporary solution until Apple fixes their player, as Nero's original aac/mp4 files will work with future versions of iTunes while retaining the gapless info that is lost in the mp4->aac->mp4 conversion.

Brief intro: When iTunes came out, I tried out all my AAC/MP4 files to test the compatibility of tags.  As annoying as it was to see the files not show any information, at least they played.  Then I learned that they could be renamed to .m4a instead of .mp4 and the tags were supposed to work, but this just stopped them from playing completely.  So here's how I make Nero-encoded AAC files (using "Transparent" settings, which is the VBR Normal::High quality) that are not only properly tagged, but properly understood by iTunes.

PLEASE READ THE ENTIRE GUIDE BEFORE DOING ANYTHING WITH IT

Tools necessary:From Rarewares (http://rarewares.hydrogenaudio.org):Note: If you want to be able to automatically add the total tracks tag to your songs, they will need to be named in the following convention: <one directory per album>\tracknumber - songname.m4a (note that this is good for iTunes since it can't read files with more than 64 characters anyway).  To do this, go to foobar's options and under "Diskwriter" set the filename to be:
Quote
%artist% - %album%\$num(%tracknumber%,2) - %title%
You don't need the folders to be called artist - album, but be sure that it is just one directory per album, not artist\album\etc...

First, set up the foobar2000 CLI encoder command line as follows (remember to change the locations of encoders to fit your system configuration, though):
Quote
Encoder: c:\windows\system32\cmd.exe
Extension: tmp
Parameters: /c c:\aacmp4\nencode.exe %s %d && c:\frontend\mp4creator60 -aac-profile=4 -extract=1 %d %d.aac && c:\frontend\mp4creator60 -aac-profile=4 -optimize -create=%d.aac %d.m4a && ~tg %d.m4a --artist "%artist%" --album "%album%" --title "%title%" --track %tracknumber% --genre "%genre%" --year %date%
Highest BPS supported: 16
Tag: None


I'll explain what this does.  It opens a command prompt and tells nencode to encode the files (by the way, be sure to run nencode.exe by itself first to set your encoding preferences.  This only has to be done once).  Then, because iTunes can't properly interpret Nero's MP4 wrapper, we use mp4creator to extract the aac file from the MP4, then mp4creator rewraps it in its own MP4 container.  Finally, tg.exe tags the files based on the tags.  Note, that this should leave you with three files per song: song.tmp (the original nero encoded MP4), song.tmp.aac (the AAC file extracted from song.tmp) and song.tmp.m4a (the final file).  To eliminate these files, open notepad and copy and paste the following (remembering to rename ~sweep if you didn't put a tilde before yours):
Quote
del /S /Q *.tmp
del /S /Q *.aac
~sweep ren *.tmp.m4a *.
~sweep ren *.tmp *.m4a


Save the file as del_temp.bat, and put it in the root of your directory with the songs.  It will then parse every subdirectory, delete the temp files and rename the final file to song.m4a, which is what iTunes understands.

-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

Here's the part I worked hardest on.  I wanted a way to have tg.exe automatically add the total number of tracks per each album.  The way I've accomplished this task is to use an automatic script execution program called AutoIt (http://www.hiddensoft.com/AutoIt/) v2.64.  This is how it works: First, it opens a command prompt in the main directory of your AAC/MP4 files (where it should see a bunch of subdirectories with all the songs), and saves a list of the folders.  Then, for each subdirectory, it lists the files with the most recently created file showing at the top and reads the first two characters (the tracknumber) of the latest created song. It then applies the total track value to every song.  It might make more sense once you've installed the program and looked at my source code.  Here's the code (commented for clarity), which you should save as <whatever>.aut in the main directory of your AAC/MP4's.
Quote
;Note that you must use double backslashes instead of single backslashes.

;Opens a command line prompt
run, cmd.exe
Sleep, 1000
send, dir /ad /b > dir.txt{ENTER}
send, exit{ENTER}

; Keeps track of the current folder that the script is parsing.  Right now, it reads line 1 for the folder name.
; Note that it updates to read the next folder later with the EnvAdd command

SetEnv, line, 1

Tag:
FileReadLine, curr_dir, dir.txt, %line%
IfEqual, ERRORLEVEL, 1, goto, end
run, cmd.exe
send, cd %curr_dir%{ENTER}

; Here, it lists the files in reverse alphabetic order and retrieves the first two characters, consequently the tracknumber of the final track.  Note that you have to change "*.m4a" to "*.mp4" below if you're using that extension.

send, dir *.m4a /b /O-N > "filelist.txt"{ENTER}
FileReadLine, last_file, %curr_dir%\\filelist.txt, 1
StringLeft, track, last_file, 2
send, ~tg *.m4a --total %track%{ENTER}
send, exit{ENTER}
FileDelete, %curr_dir%\\filelist.txt
EnvAdd, line, 1
goto, Tag

End:
FileDelete, dir.txt
Exit


After you've saved the file and you've installed AutoIt, you should be able to double-click the .aut file and it should do it's business.  Be sure not to hit the keyboard or do anything else with your computer while it's working.

Now just add your files to iTunes and check to make sure all the info (including final track numer) are there when you right-click on the files and go to "Get Info."  If you have any problems, please post them and I will try to clarify this guide.  Sorry if it's less than coherent, as I'm finishing it up at 5:24am and I haven't gotten to sleep yet 
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: menno on 2003-10-25 11:40:09
Please add some info that this method completely removes the possibility to gapless playback in Nero and other FAAD2 based players.

If that is worth anything people should just wait until Apple releases a fixed version of iTunes.

Menno
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: Muddy Mudskipper on 2003-10-25 15:50:43
I've been using the above method, only I've also been using Foobar to extract/rewrap the mp4 file.

Anyway, the upshot is that they work fine when renamed to .m4a but I discovered today that album art cannot be added to the file, even though iTunes can edit the other tags written by tg.exe.

i.e A tag change I made in iTunes was picked up by Foobar.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: CyberInferno on 2003-10-25 23:44:52
Quote
Please add some info that this method completely removes the possibility to gapless playback in Nero and other FAAD2 based players.

If that is worth anything people should just wait until Apple releases a fixed version of iTunes.

Menno

Menno, is that a flaw of mp4creator?  If so, would using the foobar2000 plug-in that converts .mp4->aac and .aac->.mp4 tool written by Case be better?
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: CyberInferno on 2003-10-26 00:00:16
Quote
I've been using the above method, only I've also been using Foobar to extract/rewrap the mp4 file.

Anyway, the upshot is that they work fine when renamed to .m4a but I discovered today that album art cannot be added to the file, even though iTunes can edit the other tags written by tg.exe.

i.e A tag change I made in iTunes was picked up by Foobar.

I've also noticed that album art doesn't work.  Have you tried using the AutoIt script for automatically adding the total track number (I'm hoping that I commented it well enough and wrote it well enough so that it's fairly versatile)?
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: menno on 2003-10-26 00:15:50
Quote
Quote
Please add some info that this method completely removes the possibility to gapless playback in Nero and other FAAD2 based players.

If that is worth anything people should just wait until Apple releases a fixed version of iTunes.

Menno

Menno, is that a flaw of mp4creator?  If so, would using the foobar2000 plug-in that converts .mp4->aac and .aac->.mp4 tool written by Case be better?

No it's not a flaw. There is just no way to store the gapless info in the .AAC, hence the gapless info is lost when converting mp4 -> aac -> mp4

Menno
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: torok on 2003-10-26 05:34:11
So, does anyone know if iTunes is working on the compatibility from thier end? They did say they were aware of the problem, but do they even care?
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: CyberInferno on 2003-10-26 07:12:30
Quote
No it's not a flaw. There is just no way to store the gapless info in the .AAC, hence the gapless info is lost when converting mp4 -> aac -> mp4

Menno

So neither Case's aac -> mp4 plugin nor mp4creator are equiped with gapless capability?  Do iTunes encoded songs have the same gapless attributes?
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: JohnV on 2003-10-26 08:17:24
Quote
So neither Case's aac -> mp4 plugin nor mp4creator are equiped with gapless capability?  Do iTunes encoded songs have the same gapless attributes?

No other encoder besides Nero and FAAC add gapless info to MP4, and FAAD2 is currently the only decoder which can use it.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: saratoga on 2003-10-26 08:27:38
With the latest foobar acting as a front end during encoding, my Nero encoded files finally play correctly.  Any idea why this happened in the first place?
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: menno on 2003-10-26 09:57:39
Quote
So, does anyone know if iTunes is working on the compatibility from thier end? They did say they were aware of the problem, but do they even care?

yes
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: menno on 2003-10-26 09:59:32
Quote
Quote
No it's not a flaw. There is just no way to store the gapless info in the .AAC, hence the gapless info is lost when converting mp4 -> aac -> mp4

Menno

So neither Case's aac -> mp4 plugin nor mp4creator are equiped with gapless capability?  Do iTunes encoded songs have the same gapless attributes?

The gapless info is completely inside the mp4 container and has nothing to do with the aac data. So if you remove the aac from the mp4 file the gapless data is lost. No way to get it back when converting the aac back to mp4.

iTunes encoded songs do not have those attributes.

Menno
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: menno on 2003-10-26 10:01:00
Quote
FAAD2 is currently the only decoder which can use it.

FAAD2 does not handle the gapless data. The frontend using the mp4 file reading library is responsible for that. Again, the gapless info has nothing to do with AAC only with the MP4 container.

Menno
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: torok on 2003-10-30 02:12:26
When I try to use mp4encode60.exe like that it whines about me changing the format, once for each conversion, and then when I'm done I have a file that's twice the size and still won't play in iTunes.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: bidz on 2003-11-01 17:38:13
Is there a way to do this, without having to re-encode the files again? (i've already done that with Nero-AAC) ? I just want to convert it from .mp4 to .m4a (or whatever works with iTunes) - not re-encode with NeroAAC again (i guess that's like transcoding, you get even worse quality).
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: StoneRoses on 2003-11-05 05:30:54
bidz,
Read this thread:
http://www.hydrogenaudio.org/forums/index....howtopic=14115& (http://www.hydrogenaudio.org/forums/index.php?showtopic=14115&)
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: CyberInferno on 2003-11-07 09:50:26
I updated my code in the initial post for the automatic total track tags to eliminate some problems (it wouldn't work if you had files other than the .m4a files in the directory before).  I also noticed that specifying a root directory was not[/] necessary, so I removed the references to it.  Please update your tg.aut (or whatever you called it) with the new code.

EDIT: Also created guide modifications using Case's foobar2000 plugin if the user chooses to do so.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: CyberInferno on 2003-11-07 10:30:24
As some others have mentioned, you can use Case's .mp4->.aac->.mp4 tool instead of mp4tools if you wish.  Here are the modifications that need to be made to the guide in order for you to do so (main changes highlighted in red) (remembering to simply ignore all references to mp4tools):

foobar2000 CLI encoder options:
Quote
Encoder: c:\windows\system32\cmd.exe
Extension: mp4
Parameters: /c c:\aacmp4\nencode.exe %s %d && ~tg %d --artist "%artist%" --album "%album%" --title "%title%" --track %tracknumber% --genre "%genre%" --year %date%
Highest BPS supported: 16
Tag: None


After encoding, add the files to foobar2000 and select them, then right-click and select "Extract AAC Track"

At this point you should delete the .mp4 files that you no longer need.  You can either save the following in a batch file, or type it in the command prompt (running it from the root directory of your music as always):
Quote
~sweep del *.mp4
Now, add all the new .aac files into foobar2000, select them, right-click on them and select "Convert to MP4."  At this point you should once again either make a batch file with the following or type the lines manually:
Quote
~sweep del *.aac
~sweep ren *.mp4 *.m4a

You can then use my automatic tagging script if you'd like to add the total tracks tag to your files.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: costello on 2003-12-18 23:49:37
Download iTunes 4.2.

All M4A files generated by foobar mp4 plugin (leveraging Nero 6.3) work fine in 4.2.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: lazyn00b on 2003-12-19 00:08:21
Quote
Download iTunes 4.2.

All M4A files generated by foobar mp4 plugin (leveraging Nero 6.3) work fine in 4.2.

I can confirm that m4a generated by foobar2000 with faac are also now read properly by this new iTunes.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: CyberInferno on 2003-12-19 00:28:43
Quote
Download iTunes 4.2.

All M4A files generated by foobar mp4 plugin (leveraging Nero 6.3) work fine in 4.2.

Awesome.  I was in the process of downloading the update when I read your post.  I'm glad to see they've fixed iTunes.  It would figure that I can't find an actual changelog.

I hope a moderator will officially close this thread and take it off the important topics list (although I enjoyed having an important thread ).  I think I might rewrite my script for automatically tagging the total number of tracks so that it can work for any filename scheme and turn it into a spinoff topic.

EDIT: Another bug fixed: Previously, album art could not be added to aac/mp4 files that were tagged by foobar.  This has now been fixed.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: rmoody on 2004-05-05 17:20:04
Forgive me if this has been covered, I tried to search with no luck.  Is there some way to adapt this to work with EAC.  I used the command line options but wind up with the temp filename with m4a extention and no tags.  I cannot for the life of the find foo_mp4 anywhere.  Everylink is dead.  Thanks.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: KAC on 2004-05-05 18:08:48
I got the foobar nero plugin from here.

http://www.saunalahti.fi/cse/foobar2000/foo_nero.zip (http://www.saunalahti.fi/cse/foobar2000/foo_nero.zip)
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: rmoody on 2004-05-06 20:21:42
I am VERY confused with all of this.  Is there any sort of step-by-step clear-cut simple and descriptive howto on this?  You know, for someone that is totally and completely lost in every way with foobar.  Honestly, I must be a freaking moron because I can't seem to understand a single thing about this program at all.

Where do the tags come from?  They don't make it to my M4A files.  Is there a way to just re-wrap the MP4 files only?  I have tried my best to take out the nencode part and get nothing but errors like "Encoding failed".  I know that it's is me that is the problem here and not foobar, total user error of the highest order.  My dream is to be able to use EAC to rip my CDs, have them encoded by nero, and play them on my iPod.  Is this an impossible dream?
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: rmoody on 2004-05-06 20:38:09
Someone throw me a line and tell me if I am coming close to what is going on.

foobar takes the source file, in this case a WAV, copies it to a temporary file, whatever.fb2k.tmp.wav
nencode takes the fb2k.tmp.wav file and encodes it to whatever.TMP
mp4creator takes the TMP file and extracts the AAC as whatever.AAC
mp4creator takes the AAC file and re-wraps is at whatever.M4A

Is that right?  I still don't understand the tagging part though, please help a hopeless foobar dummy.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: KAC on 2004-05-13 14:38:09
This is what I've just started doing.

EAC -> FLAC using this command line:

-8 -V -T "title=%t" -T "artist=%a" -T "album=%g" -T "date=%y" -T "tracknumber=%n" -T "genre=%m" %s

I then use Foobar to add replaingain and the foo_nero plugin to encode them to AAC with all the tags complete. All that's left is to move them to itunes and then my iPod.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: Space Cowboy on 2005-01-15 19:00:28
Quote
This is what I've just started doing.

EAC -> FLAC using this command line:

-8 -V -T "title=%t" -T "artist=%a" -T "album=%g" -T "date=%y" -T "tracknumber=%n" -T "genre=%m" %s

I then use Foobar to add replaingain and the foo_nero plugin to encode them to AAC with all the tags complete. All that's left is to move them to itunes and then my iPod.
[a href="index.php?act=findpost&pid=210915"][{POST_SNAPBACK}][/a]


This is what I've been doing, but foo_nero doesn't seem to make iTunes readable tags for me. 
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: menno on 2005-01-15 19:06:55
Quote
Quote
This is what I've just started doing.

EAC -> FLAC using this command line:

-8 -V -T "title=%t" -T "artist=%a" -T "album=%g" -T "date=%y" -T "tracknumber=%n" -T "genre=%m" %s

I then use Foobar to add replaingain and the foo_nero plugin to encode them to AAC with all the tags complete. All that's left is to move them to itunes and then my iPod.
[a href="index.php?act=findpost&pid=210915"][{POST_SNAPBACK}][/a]


This is what I've been doing, but foo_nero doesn't seem to make iTunes readable tags for me. 
[a href="index.php?act=findpost&pid=265580"][{POST_SNAPBACK}][/a]


ren *.mp4 *.m4a
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: Tropican on 2005-06-03 17:33:06
Quote
Quote
Download iTunes 4.2.

All M4A files generated by foobar mp4 plugin (leveraging Nero 6.3) work fine in 4.2.

I can confirm that m4a generated by foobar2000 with faac are also now read properly by this new iTunes.
[a href="index.php?act=findpost&pid=165046"][{POST_SNAPBACK}][/a]


Does this mean that extracting the AAC stream and remuxing is no longer nessesary unless you use iTunes pre-4.2?  If so, someone should add that to the first post, as people may not read the whole discussion and destroy their gapless info for no reason.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: Lipton on 2007-04-13 11:32:11
Is there any reason for this thread to be pinned? It seems the information has mostly been obsolete for a couple of years already, and it isn't very helpful anymore, just confusing.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: methodmanrdm on 2007-09-15 22:51:38
agreed. i was just about to do this before i read the date hah.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: QHOBBES 2.0 on 2007-09-22 09:04:09
seconded. I just started ripping songs to Nero Q .45 (so they should all be LC) and wanted to come read this guide to see if I could make them iTunes/iPod compatible because I plan on finally buying a mp3 player soon and it will probably be an iPod Nano. But this should either be unpinned or updated, I'm sure there is less complicated ways to due now and nero provides their aac encoder for free too.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: Jens Rex on 2007-09-22 09:28:54
Thread unpinned.

Besides, I've used neroaacenc files on my 4G iPod for about a year now with no problems.
Title: Guide to iTunes-compatible Nero-encoded AAC
Post by: Junon on 2007-09-22 14:24:59
Quote
[...]I'm sure there is less complicated ways to due now and nero provides their aac encoder for free too

To me it looks like nowadays you just have to respect the .m4a extension for the MP4 container.

Though I'm not the owner of an iPod myself, I also conducted some testing with Nero AAC played back in iTunes some time ago. This was mainly to make sure the encodings are compatible to the offically unspecified AAC standards introduced by Apple, e.g. MP4 tagging and gapless playback. Especially the latter was of interest, since to my knowledge Nero and Apple use different approaches of getting continous track transitions running. To my surprise, iTunes flawlessly supports Nero's way of handling this matter. Don't know whether this is also valid for the iPod, though.