Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Error code 2 when converting to Apple Lossless (Read 11376 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Error code 2 when converting to Apple Lossless

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.

Re: Error code 2 when converting to Apple Lossless

Reply #1
It's a problem with qaac v2.63. You can download fixed version from https://sites.google.com/site/qaacpage/cabinet. If you use the Free Encoder Pack 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.

Re: Error code 2 when converting to Apple Lossless

Reply #2
Perfect! Fixed the problem--many thanks!

Re: Error code 2 when converting to Apple Lossless

Reply #3
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"

 

Re: Error code 2 when converting to Apple Lossless

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


Re: Error code 2 when converting to Apple Lossless

Reply #5
yeah, got those, gave it another try, and it didn't fix it :/

Re: Error code 2 when converting to Apple Lossless

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

Re: Error code 2 when converting to Apple Lossless

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

Re: Error code 2 when converting to Apple Lossless

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

Re: Error code 2 when converting to Apple Lossless

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

Re: Error code 2 when converting to Apple Lossless

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

Re: Error code 2 when converting to Apple Lossless

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

Re: Error code 2 when converting to Apple Lossless

Reply #12
Foobar apparently prefers refalac over qaac. I guess refalac is more limited in what it can encode?

Re: Error code 2 when converting to Apple Lossless

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

Re: Error code 2 when converting to Apple Lossless

Reply #14
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 .  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) 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.