HydrogenAudio

Hosted Forums => foobar2000 => Support - (fb2k) => Topic started by: 11wrighta on 2017-05-20 05:40:40

Title: Error code 2 when converting to Apple Lossless
Post by: 11wrighta on 2017-05-20 05:40:40
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.
Title: Re: Error code 2 when converting to Apple Lossless
Post by: Case on 2017-05-20 09:10:58
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.
Title: Re: Error code 2 when converting to Apple Lossless
Post by: 11wrighta on 2017-05-21 20:03:38
Perfect! Fixed the problem--many thanks!
Title: Re: Error code 2 when converting to Apple Lossless
Post by: NexusRasp on 2020-11-21 17:58:03
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"
Title: Re: Error code 2 when converting to Apple Lossless
Post by: sveakul on 2020-11-21 20:25:18
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)

Title: Re: Error code 2 when converting to Apple Lossless
Post by: NexusRasp on 2020-11-21 21:27:40
yeah, got those, gave it another try, and it didn't fix it :/
Title: Re: Error code 2 when converting to Apple Lossless
Post by: sveakul on 2020-11-21 22:10:12
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?
Title: Re: Error code 2 when converting to Apple Lossless
Post by: Porcus on 2020-11-21 22:13:13
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.)
Title: Re: Error code 2 when converting to Apple Lossless
Post by: NexusRasp on 2020-11-22 01:39:06
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.
Title: Re: Error code 2 when converting to Apple Lossless
Post by: kode54 on 2020-11-22 03:23:50
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.
Title: Re: Error code 2 when converting to Apple Lossless
Post by: NexusRasp on 2020-11-22 04:58:58
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!
Title: Re: Error code 2 when converting to Apple Lossless
Post by: sveakul on 2020-11-22 05:16:17
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?
Title: Re: Error code 2 when converting to Apple Lossless
Post by: kode54 on 2020-11-22 06:49:27
Foobar apparently prefers refalac over qaac. I guess refalac is more limited in what it can encode?
Title: Re: Error code 2 when converting to Apple Lossless
Post by: Case on 2020-11-22 08:30:40
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.
Title: Re: Error code 2 when converting to Apple Lossless
Post by: sveakul on 2020-11-22 19:31:29
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.