Skip to main content
Topic: Guide to iTunes-compatible Nero-encoded AAC (Read 66369 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Guide to iTunes-compatible Nero-encoded AAC

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:
  • Nero 6 (I'm using 6.0.0.19 with aacenc.dll version 2.5.5.8)
  • foobar2000 with the CLI encoder (I personally use Case's special installer from his page).
  • Case's "sweep" tool
    (extract the program to c:\windows\system32 so that it can be called quickly without using the entire program location.  I have mine named ~sweep.exe so that I can find it quickly).
  • richard123's command line aac/mp4 tagger (same deal as with sweep, once again, mine's prefixed by a tilde, ~tg.exe)
From Rarewares:
  • Nencode
  • mp4tools v0.9.9 /alternate version not using mp4tools available below.  Note that Menno's warning still applies regardless of the tool you use.
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 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 
-CyberInferno

Guide to iTunes-compatible Nero-encoded AAC

Reply #1
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

Guide to iTunes-compatible Nero-encoded AAC

Reply #2
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.

Guide to iTunes-compatible Nero-encoded AAC

Reply #3
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?
-CyberInferno

Guide to iTunes-compatible Nero-encoded AAC

Reply #4
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)?
-CyberInferno

Guide to iTunes-compatible Nero-encoded AAC

Reply #5
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

Guide to iTunes-compatible Nero-encoded AAC

Reply #6
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?

Guide to iTunes-compatible Nero-encoded AAC

Reply #7
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?
-CyberInferno

Guide to iTunes-compatible Nero-encoded AAC

Reply #8
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.
Juha Laaksonheimo

Guide to iTunes-compatible Nero-encoded AAC

Reply #9
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?

Guide to iTunes-compatible Nero-encoded AAC

Reply #10
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

Guide to iTunes-compatible Nero-encoded AAC

Reply #11
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

Guide to iTunes-compatible Nero-encoded AAC

Reply #12
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

Guide to iTunes-compatible Nero-encoded AAC

Reply #13
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.

Guide to iTunes-compatible Nero-encoded AAC

Reply #14
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).
myspace.com/borgei - last.fm/user/borgei


Guide to iTunes-compatible Nero-encoded AAC

Reply #16
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.
-CyberInferno

Guide to iTunes-compatible Nero-encoded AAC

Reply #17
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.
-CyberInferno

Guide to iTunes-compatible Nero-encoded AAC

Reply #18
Download iTunes 4.2.

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

Guide to iTunes-compatible Nero-encoded AAC

Reply #19
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.

Guide to iTunes-compatible Nero-encoded AAC

Reply #20
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.
-CyberInferno

Guide to iTunes-compatible Nero-encoded AAC

Reply #21
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.


Guide to iTunes-compatible Nero-encoded AAC

Reply #23
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?

Guide to iTunes-compatible Nero-encoded AAC

Reply #24
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.

 
SimplePortal 1.0.0 RC1 © 2008-2019