When I try to convert any audio file to Apple Lossless I receive error code 2:
"An error occurred while writing to file (The encoder has terminated prematurely with code 2 (0x00000002); please re-check parameters) ... Conversion failed: The encoder has terminated prematurely with code 2 (0x00000002); please re-check parameters"
Has anyone else encountered this error, or can offer a solution? I'm not sure if it has to do with the recent iTunes update (for Windows, version 12.6.1) but I did not notice this problem with any previous version installed.
It's a problem with qaac v2.63. You can download fixed version from https://sites.google.com/site/qaacpage/cabinet (https://sites.google.com/site/qaacpage/cabinet). If you use the Free Encoder Pack (http://www.foobar2000.org/encoderpack) and prefer its simplicity a fixed version is attached to this post. Peter has been offline so the official pack unfortunately contains a bad version.
Perfect! Fixed the problem--many thanks!
Sorry to deadthread, but I'm having the exact same problem. I've got iTunes installed, the latest version of foobar, the latest version of the free encoder pack, and i get the same error message.
"Conversion failed: The encoder has terminated prematurely with code 2 (0x00000002); please re-check parameters"
According to the qaac developer, the latest version of the iTunes installer (12.10.9.3+) requires at least version 2.70 of qaac.exe (https://sites.google.com/site/qaacpage/news/qaacrelease270refalac170 (https://sites.google.com/site/qaacpage/news/qaacrelease270refalac170)), which is not currently supplied by the free encoder pack. You can download the 2.71 version of qaac.exe (updated Oct. 2 2020) here:
https://sites.google.com/site/qaacpage/cabinet/qaac_2.71.zip?attredirects=0&d=1 (https://sites.google.com/site/qaacpage/cabinet/qaac_2.71.zip?attredirects=0&d=1)
yeah, got those, gave it another try, and it didn't fix it :/
What version of iTunes do you have installed? Is it actually the 12.10.9.3 version?
Things to check for:
1. The new qaac for the new iTunes must use its 64-bit version (qaac64.exe) if the 64-bit iTunes is installed, which wasn't previously the case.
2. Did you put the two dll's that came with qaac (libsoxr64.dll, libsoxconvolver64.dll) into the Foobar encoders folder as well?
I should maybe not use this thread to bash Apple Lossless, but OP: unless you have a specific need for it, it is not the best of formats. (Yes it is lossless, but you might be interested in error checking etc.)
right now i'm using iTunes version 12.11.0.26, which might be the problem. i do have the 64-bit versions, as well as the dll's in the proper folder.
Qaac only works with the non-Microsoft Store versions of iTunes. Otherwise, you have to use the refalac.exe encoder, which is a compiled build of the reference codec from the source code that Apple published.
AH, that did it, thank you. I had both refalac and qaac, and removing refalac fixed it. clearly they were interfering with each other. thank you!
I'm glad it works for you now, but I don't know why removing refalac would have affected anything if you are specifying qaac as your encoder--they're two separate encoders (granted, they can both produce alac files). They are both supplied by default in the Free Encoder Pack. Kode54 can you comment?
Foobar apparently prefers refalac over qaac. I guess refalac is more limited in what it can encode?
I'd be curious to hear what kind of source file you had that refalac failed to convert.
And sorry about not updating Free Encoder Pack with newer qaac - I hoped to modify it to work with Microsoft Store version of iTunes but I can only do that with a workaround. The encoder gets access denied error when using the dlls from the Store version's install directory but works fine if qaac.exe copies them outside the dir and uses the copies. I suspect the Store version will be the most used iTunes soon and I really want Free Encoder Pack to just work for most users.
Thanks kode54 and Case for the comments. In case it helps the OP, I have no problems converting FLAC to ALAC with Foobar 1.6.2 and qaac64.exe 2.71--here is my setup:
Environment:
1. I do NOT have iTunes64 "installed", but used the "makeportable.cmd" technique described elsewhere in the forum to create a standalone folder of just the iTunes64 files required for the conversion from the installer file. I used this technique against the latest non-Microsoft Store version of iTunes64, version 12.11.0.26, from the download link here: https://www.apple.com/itunes/download/win64 (https://www.apple.com/itunes/download/win64) . The "QTfiles64" folder created by makeportable is then placed in my Foobar2000/encoders folder. Note: you need to use the newer "makeportable2.cmd" file from the qaac developer's site (https://sites.google.com/site/qaacpage/cabinet (https://sites.google.com/site/qaacpage/cabinet)) to work with the newest iTunes64.
2. I have downloaded qaac 2.71 from the qaac site and extracted qaac64.exe, libsoxr64.dll, and libsoxconvolver64.dll from the zip directly into my Foobar encoders folder.
3. Created a custom conversion option in Foobar for ALAC, using qaac64.exe and the command line -A -o %d -
Using that custom option converts FLAC to ALAC just fine. Windows 10 v2004 x64.