Author Topic: Using the latest qaac64.exe to encode in MusicBee without installing iTunes  (Read 18814 times)

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
These procedures have appeared in various posts and various pieces elsewhere on the forum, but as there have been some recent changes affecting them I thought it best to compile everything into one source.

The qaac encoder uses the original Apple iTunes library files to produce AAC and ALAC(Apple Lossless) files.  However, many people (including myself) don't want to have to install the entire iTunes application on their PC just to have that capability.  This post describes a way to use qaac64 2.71 within MusicBee WITHOUT needing iTunes actually installed on your system.  Only the 64-bit versions of the relevant files are being addressed, requiring of course a 64-bit OS by the user.  While MusicBee is 32-bit, it will work just fine using the instructions below.

A.  Acquiring the tools

First you will need to download 3 files:

1. qaac_2.71.zip

https://sites.google.com/site/qaacpage/cabinet/qaac_2.71.zip?attredirects=0&d=1 (see following post)

2. Makeportable2.zip

https://sites.google.com/site/qaacpage/cabinet/makeportable2.zip?attredirects=0&d=1 (see following post)

3. The latest non-Microsoft Store version of the iTunes64Setup.exe file (do NOT install it!!)

https://www.apple.com/itunes/download/win64

(Note: due to changes in how Apple packages its libraries only versions of iTunes64 equal to or greater than 12.10.9.3 can be used with the latest version of qaac64 (2.71), which was modified by its developer to work with those changes.  Version 12.11.0.26 dated November 12, 2020, was used by me in these instructions.)

B.  Preparing the tools for use

Then:

1.  From makeportable2.zip, extract "makeportable2.cmd" to the same folder as the iTunes64Setup.exe file you downloaded.

**EDIT**: makeportable2.cmd assumes that you already have 7-Zip (www.7-zip.org) installed on your PC, which it uses during the iTunes setup file's extraction process.  If you would rather not install 7-zip, you can put the files 7z.exe and 7z.dll from the portable version into the same folder as makeportable2.cmd and iTunes64Setup.exe before doing the next step; they can be deleted afterwards.

2.  Double-click makeportable2.cmd and let it run; a command window will open and you'll see text scroll by, stopping momentarily with the message "All is OK!"--do NOT close the window, it will pause at this for about 10 seconds, then continue to run until completion, when the window will close on its own.

3.  You will then see that a folder named "QTfiles64" has been created inside the folder in which you ran step #2;  this contains all the files needed by qaac64 from iTunes64 to run portablely.

4.  Move the folder itself "QTfiles64" you just created into the MusicBee "Codec" folder.

5.  Next, open qaac_2.71.zip from where you downloaded it, and from inside the zip's "x64" subfolder extract the files qaac64.exe, libsoxr64.dll, and libsoxconvolver64.dll directly into your MusicBee "Codec" folder.  You do NOT need to extract the "refalac64.exe" file.

6.  You can now delete the three files you downloaded originally.

C.  Setting up MusicBee's encoding options for AAC and ALAC with qaac64

1.  In MusicBee, go to Preferences->File Converters

2.  Check the box "AAC enabled," and in encoder location hit the "..." button and browse to qaac64.exe in the MusicBee "Codec" folder.

3.  Under "encoding parameters", delete anything already in the 4 boxes below.

4.  For our AAC example, we will choose parameters that give results identical to what iTunes Plus uses, which is AAC CVBR at 256k variable birate.  In the box labelled "high quality" put the following parameters:

Code
--ignorelength --no-smart-padding -v 256 -q 2 -o [outputfile] -

5.  Leave the 3 other boxes for other qualities empty for now (see end of section D below).

6.  Move down the list and check "ALAC enabled," and in encoder location hit the "..." button and browse to qaac64.exe in the MusicBee "Codec" folder.

7.  Un-check the box "reduce file size using lossyWAV" and delete any pre-existing content in the 2 encoding parameter boxes.

8.  In both the "max" and "std." compression boxes put the following parameters:

Code
--alac --ignorelength -o [outputfile] -

Finally, hit the "Save" button in the lower corner.  We are ready to ROCK..

D.  Converting files to AAC or ALAC in MusicBee with qaac64.exe

Right-click the file you wish to convert from your track list and choose "Send to->Format Converter."  In the Converter window drop the "encode as" arrow and choose AAC, and in "encoding profile" choose High Quality (this was the box in the converter settings we put the options for an iTunes Plus-style encode of CVBR 256k).  Select your output location, and the other options below as you want them to be.  Finally, hit "Proceed;" the file will then be created.

For Apple Lossless (ALAC), change to "encode as ALAC" and choose either profile (we put the same options in both).  Set your other options and Proceed.

Now you can go back to the File Converters settings in Preferences and complete the 3 other profile parameters for AAC if you want to add different encoding options for qaac64.  Your choices of options is documented at the developer's site here: https://github.com/nu774/qaac/wiki/Encoder-configuration

Addendum:  if you already had a 64-bit version of iTunes fully installed on your PC, and it is equal to or greater than version 12.10.9.3, you only need to do steps A-1, B-5, and of course C and D to use qaac64 2.71.
Last Edit: September 21, 2023, 12:11:58 AM by sveakul

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
Due to changes in the qaac developer's site, a couple of the links in the post above have changed for tools:

Qaac (currently at version 2.72) is now downloadable at the page here: https://github.com/nu774/qaac/releases

The makeportable2.cmd file is no longer available as a zipped package---go here https://raw.githubusercontent.com/nu774/makeportable/master/makeportable2.cmd ;  in Firefox you would then need to go File/Save Page As which will allow you to save as the makeportable2.cmd file.

The latest iTunes64 installer is still available from https://www.apple.com/itunes/download/win64 .  The version available there (currently 12.11.3.17) is newer than the one at the support.apple.com/downloads site.

ruudbouwhuis

  • Newbie
  • *
  • Posts: 4
Hello,

I followed your instructions and it worked perfect, the AAC encoder is installed and it works.
However, the converted files have the M4A extension instead of AAC.
Is there a setting that makes the encoder generate AAC files instead of M4A?
(I have a portable player that can play AAC but refuses M4A)

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
I'm glad it worked for you.  The reason the files are wrapped as M4A is because there is no standard tagging format for raw AAC, whereas as M4A takes a standard range of MP4 tags that most players deal with easily.  You CAN "force-fit" tags like ID3 onto raw AAC, but there is no guarantee they will play properly afterwards.

I would first check to see if your portable player is just looking for an AAC file extension vs. raw ADTS AAC.  Try just changing the extension of an M4A to AAC and see if it will play.

If you really do want raw AAC, you can un-wrap the M4A's you created with this command line run in the appropriate folder;  it will extract raw AAC from every M4A file inside of that folder, keeping the original M4A.  The operation is lossless.  Change the path to ffmpeg.exe to match yours:

Code
FOR %F IN (*.m4a) DO C:\ffmpeg\ffmpeg.exe -i "%F" -c:a copy "%~nF.aac"

wealstarr

  • Full Member
  • ***
  • Posts: 128
Thank you for this helpful guide sveakul. I use Qaac with dBpoweramp. The package needs to be installed is AppleApplicationSupport64.msi which can be extracted from Itunes installer but to best of my knowledge Apple has removed the package from the iTunes installer post version: v12.10.8.5

One thing I should mention is that using this method, encoding the files with Apple AV Foundation (CoreAudioToolbox) is the closest thing one will get to lossless in lossy files. I can barely tell the difference between the source lossless FLACs and lossy files transcoded with Apple Av foundation.

Better channel mapping too.

Highly recommended if you want to shrink the size of your library while keeping the catalog intact.

Also, highly recommended for the users of other lossy codecs like MP3, Once you start encoding with Apple's AAC encoder, you will never want to go back to MP3's.

One last thing, only use lossless files as a source.  Your current MP3 catalog won't enhance any quality but the transcoding process will surely reduce some.
Last Edit: July 28, 2021, 09:47:37 AM by wealstarr

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
Thanks wealstarr for the comments!  Yes, the internal structure of the iTunes installer was changed sometime last fall I believe.  The beauty of the makeportable2.cmd method is not only has it been adapted to the new structure, it places all the needed files inside one folder without requiring an installer to use (created by the same developer as qaac/64.exe).

I agree with you that AAC files encoded this way (using Apple's CoreAudioToolbox) are top-notch for "lossy."  While Opus seems to edge them out on the listening tests I've seen, they are compatible with more devices and for purists retain HF info that Opus "rounds out" (to what actual effect takes us into the "audiophile" realm I try to avoid).

wealstarr

  • Full Member
  • ***
  • Posts: 128
Quote
makeportable2.cmd

That's indeed one great solution for Apple's dedication to hide, forbid it's encoder to be used with 3rd party programs. I use dBpoweramp for encoding and they haven't updated their wrapper for qaac in a long time. I'm still on version 2.67 but the thing is it works great. I have absolutely no issues and wishes beyond what it already does so it's all cool.

Having said that, I really need to remember this guide as who knows what my setup in future would be. In any case, this could come in really useful considering that apart from Apple's AV foundation, there isn't any option for me. I use FLAC's for archiving only.

So I thank you again for this very useful guide. I wish more people read it and switch to Apple's AAC encoded files. That encoder is some alien tech shit. Reducing the size by 80% and preserving the quality by 96%, how's that even possible? Plus it does something else to the audio clipped beyond certain threshold, not to mention the superior channel mapping.

Majority of people are still listening to MP3, I wish they understand what they are missing out.

hiccup

  • Sr. Member
  • ****
  • Posts: 7788
Majority of people are still listening to MP3, I wish they understand what they are missing out.
With regards to audio quality, when using mp3 at higher bitrates (>256k): they are not missing out on anything.

I believe that aac is supposed to have a better sound quality at lower bitrates, but most people won't care about using files with low bitrates to begin with.
Perhaps on a phone, or a limited portable mp3 player, but then still the file size gains of using aac low bitrate vs. mp3 low bitrate is not worth the trouble. (in my opinion)
And the people that have higher demands on sound quality and/or don't want to expose themselves to any doubts on what lossy compression was used, and how well the result compares to the original lossless file will be using lossless flac.

Apart from Apple having its ugly claws in the format, the negatives of m4a metadata handling for me outweighs any possible or assumed positives.

wealstarr

  • Full Member
  • ***
  • Posts: 128
With regards to audio quality, when using mp3 at higher bitrates (>256k): they are not missing out on anything.

I respectfully disagree. The difference between MP3 V0 and 256 AAC VBR is huge, as much as the difference between MP3 V0 and lossless but only when encoded with the Apple's encoder. Other AAC encoded are still better than MP3 but not as much as Apple's AAC.

Also, as noted above, there is indistinguishable difference  between Apple's AAC 256 VBR and FLAC. I really can't tell them apart. Basically I'm listening to lossless at ~80% reduced size. This is huge plus especially for the people with big libraries or those who are still on HDD like me. Smaller files load faster in the player compared to the bigger ones.

If I may ask, what issues did you face with the metadata? I use dBpoweramp for manually correcting the tags and MP3tag with Deezer API  for auto tagging the FLAC files and then transcoding them into AAC before exporting them into the library. Never had any issues not even a hint.


hiccup

  • Sr. Member
  • ****
  • Posts: 7788
If you are saying that you can hear a difference between mp3 V0 and aac 256k, and that you can not hear a difference between lossy aac 256k and lossless flac, the only sensible thing I can do is believe you.

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
However, the converted files have the M4A extension instead of AAC.
Is there a setting that makes the encoder generate AAC files instead of M4A?

In the spirit of completeness, I have to add that this will do what you requested:

1.  Go into Prefs/File Converters/encoding in the AAC section and in the parameter line choices add the option "--adts", like:

Code
--ignorelength --no-smart-padding --adts -v 256 -q 2 -o [outputfile] -
(gives the same quality as in the above tutorial)

2.  In the MusicBee directory, find Configuration.xml and change the line "<Codec Code="2" Name="AAC" DefaultFileExtension=".m4a">" to "<Codec Code="2" Name="AAC" DefaultFileExtension=".aac">

3.  Now ALL files you encode using the AAC profile will end up as raw ADTS AAC files with the *.aac extension.  Remember that means no tags.

If you decide later you want to wrap them as .m4a so they can be tagged, this command line in the appropriate directory will do that (change path of ffmpeg.exe to match yours):

Code
FOR %F IN (*.aac) DO C:\ffmpeg\ffmpeg.exe -i "%F" -codec copy "%~nF.m4a"
Last Edit: July 30, 2021, 04:36:11 AM by sveakul

OWEI

  • Jr. Member
  • **
  • Posts: 26
Due to changes in the qaac developer's site, a couple of the links in the post above have changed for tools:

Qaac (currently at version 2.72) is now downloadable at the page here: https://github.com/nu774/qaac/releases

The makeportable2.cmd file is no longer available as a zipped package---go here https://raw.githubusercontent.com/nu774/makeportable/master/makeportable2.cmd ;  in Firefox you would then need to go File/Save Page As which will allow you to save as the makeportable2.cmd file.

The latest iTunes64 installer is still available from https://www.apple.com/itunes/download/win64 .  The version available there (currently 12.11.3.17) is newer than the one at the support.apple.com/downloads site.

Hi @sveakul
Im sorry, I don't understand how to run the makeportable2.cmd file, I have saved it as a page, but am at a loss as to what to do with it, please would you advise me?
Thanks

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
Hi @sveakul
Im sorry, I don't understand how to run the makeportable2.cmd file, I have saved it as a page, but am at a loss as to what to do with it, please would you advise me?
Thanks
If you have it saved as a FILE, using the "Save page as.." menu in Firefox as I described, put that file (makeportable2.cmd) in a folder with the iTunes64Setup.exe file you downloaded from https://www.apple.com/itunes/download/win64.  Then follow the instructions I wrote in my first post's Section B, from Step 2 onwards.

OWEI

  • Jr. Member
  • **
  • Posts: 26
Hi @sveakul
Im sorry, I don't understand how to run the makeportable2.cmd file, I have saved it as a page, but am at a loss as to what to do with it, please would you advise me?
Thanks
If you have it saved as a FILE, using the "Save page as.." menu in Firefox as I described, put that file (makeportable2.cmd) in a folder with the iTunes64Setup.exe file you downloaded from https://www.apple.com/itunes/download/win64.  Then follow the instructions I wrote in my first post's Section B, from Step 2 onwards.

I saved it using All Files (*.*), if I double click on it, it looks like it briefly tries to open it and then stops, so it won't run?

Last Edit: September 19, 2023, 07:59:26 PM by OWEI

sveakul

  • Sr. Member
  • ****
  • Posts: 2438
The "Save as" type should have been left as Text Document, the default.

Just put the two files in some generic folder, make one like "C:\test" or something.  Run the *.cmd from there normally, and when it finishes move the folder it creates as described in the instructions.  Do NOT choose "run as Administrator."  Remember that as described there will be a pause during the run, do NOT exit, the process will exit on its own when it completes.