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: Opus conversion failure (Code -1073741502) (Read 1159 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Opus conversion failure (Code -1073741502)

Hi. I've have latest version of f2k v2.24.3 plus Free_Encoder_Pack-2025-02-24 on Windows 10.
I am getting the error below when converting any FLAC file to Opus. Also tried to update the Opus encoder (opusenc.exe) in the /encoders folder to Opus 1.3. Still no joy.
When I run the conversion directly from the opusenc command line using the same opusenc.exe on the same FLAC file, then it converts successfully (same parameters).
Converting the same FLAC files to any other formats in f2k is successful.
So it seems the problem is just with the Opus encoder inside f2k.
Maybe someone knows what might be going on? I have no idea what that error code means.
I am no dev or command line expert, but that lone dash in the foobar command line just before the output file name, looks a little suspect.
Thank you.

Code: [Select]
Source: "D:\Artist - Title.flac"
  An error occurred while writing to file (The encoder has terminated prematurely with code -1073741502 (0xC0000142); please re-check parameters) : "D:\Artist - Title.opus"
  Additional information:
  Encoder stream format: 44100Hz / 2ch / 16bps
  Command line: opusenc.exe --quiet --bitrate 192 --vbr --music --ignorelength - "Artist - Title.opus"
  Working folder: D:\
  Conversion failed: The encoder has terminated prematurely with code -1073741502 (0xC0000142); please re-check parameters

Edit: Okay I see in the opusenc --help that if the input file is "-", then audio data is read from stdin. So pls. ignore that comment of mine.

Re: Opus conversion failure (Code -1073741502)

Reply #1
Code 0xC0000142 is STATUS_DLL_INIT_FAILED, ('Initialization of the dynamic link library %hs failed. The process is terminating abnormally.').

Perhaps it's not using the correct opusenc.exe. If you run
Code: [Select]
where opusenc.exe
in a Windows command prompt, what is the result?
.

Re: Opus conversion failure (Code -1073741502)

Reply #2
I have the same components, opusenc.exe as delivered by the latest free encoder pack, 64-bit Foobar v.2.24.3, Windows 11 24H2.  I use a custom script within the Foobar converter:
Code: [Select]
--quiet --bitrate 256 --vbr --ignorelength - %d

Bit depth set to 32-bit float.  FLAC to Opus conversions working fine within the Foobar converter dialog.

Re: Opus conversion failure (Code -1073741502)

Reply #3
Code 0xC0000142 is STATUS_DLL_INIT_FAILED, ('Initialization of the dynamic link library %hs failed. The process is terminating abnormally.').

Perhaps it's not using the correct opusenc.exe. If you run
Code: [Select]
where opusenc.exe
in a Windows command prompt, what is the result?

When I run that I get: "INFO: Could not find files for the given pattern(s)."

Note that I didn't change the drive (cd) in the command line to where the opusenc.exe is located. Note sure if that was expected.

Re: Opus conversion failure (Code -1073741502)

Reply #4
I have the same components, opusenc.exe as delivered by the latest free encoder pack, 64-bit Foobar v.2.24.3, Windows 11 24H2.  I use a custom script within the Foobar converter:
Code: [Select]
--quiet --bitrate 256 --vbr --ignorelength - %d

Bit depth set to 32-bit float.  FLAC to Opus conversions working fine within the Foobar converter dialog.

Tried now to create a custom conversion script myself in f2k, pointing the encoder directly to C:\Program Files\foobar2000\encoders\opusenc.exe, and still the same problem. Very odd.

Re: Opus conversion failure (Code -1073741502)

Reply #5
Problem solved!!  :D
 
I continued working with the custom encoder script in f2k as sveakul described. After removing "--quiet" from the Parameters field in the custom encoder settings (i.e. left with just "--bitrate 192 --vbr --ignorelength - %d") it magically started working. Hoorah!

Thank you all both for your help and hints. Cheers.

Re: Opus conversion failure (Code -1073741502)

Reply #6
It certainly sounds like you are using a wrong opus encoder. Load one of the files you converted into foobar2000, open its Properties, then open Details tab, and check the technical field 'Tool' at the bottom. It will tell encoder version information. With the encoder from the Free Encoder Pack the Tool field should show "libopus 1.5.2, libopusenc 0.2.1".

Since you don't seem to have wrong opusenc in the system search path, perhaps you have configured custom encoder paths in foobar's Preferences. Check Preferences -> Advanced -> Tools -> Converter -> Additional command line encoder paths.

Re: Opus conversion failure (Code -1073741502)

Reply #7
It certainly sounds like you are using a wrong opus encoder. Load one of the files you converted into foobar2000, open its Properties, then open Details tab, and check the technical field 'Tool' at the bottom. It will tell encoder version information. With the encoder from the Free Encoder Pack the Tool field should show "libopus 1.5.2, libopusenc 0.2.1".

Since you don't seem to have wrong opusenc in the system search path, perhaps you have configured custom encoder paths in foobar's Preferences. Check Preferences -> Advanced -> Tools -> Converter -> Additional command line encoder paths.

Yeah, seems I was a bit hasty with my "problem solved". I momentarily forgot that when I was playing around with the custom decoder settings, I had set the path to some old opusenc.exe file (libopus 1.3, libopusenc 0.2.1) that was in the installation directory of an old version of dbPoweramp which I never got around to paying for an update. So that old one seems to be working but not the one in the f2K folder.

When  I set the custom decoder path back to the encoder from the Free Encoder Pack in the f2K installation folder, it fails again. Back to square one. I am completely stumped.

I have not configured custom encoder paths in foobar's Preferences -> Advanced -> Tools -> Converter -> Additional command line encoder paths. It's empty.

What did you mean by "...in the system search path"? How can I configure this if it might be the culprit?

Re: Opus conversion failure (Code -1073741502)

Reply #8
System search path manipulation is not a solution for this problem as there is already enough confusion. Adding more variables is not a good idea for now.

Please use Process Monitor to record what happens that generates the error you see. Once you have the error captured you can stop recording using the Play-button looking symbol on the toolbar.
You can filter out everything unrelated:
Click 'Tools' -> 'Process Tree...'
Find foobar2000.exe from the process tree, right click it and select 'Add process and children to Include filter'.
Close the Process Tree dialog with 'Close'.
Select 'File' -> 'Save...' and save the displayed results using PML format.
Please share the saved file here. You can compress it before uploading, the format compresses very well even with simple zipping.

Re: Opus conversion failure (Code -1073741502)

Reply #9
Yeah, seems I was a bit hasty with my "problem solved". I momentarily forgot that when I was playing around with the custom decoder settings, I had set the path to some old opusenc.exe file (libopus 1.3, libopusenc 0.2.1) that was in the installation directory of an old version of dbPoweramp which I never got around to paying for an update. So that old one seems to be working but not the one in the f2K folder.

When  I set the custom decoder path back to the encoder from the Free Encoder Pack in the f2K installation folder, it fails again. Back to square one. I am completely stumped.
1.  Delete any "opusenc.exe" in Foobar/encoders or elsewhere
2.  Re-install the Free Encoder Pack and don't change any paths; point the Destination Folder to your main Foobar2000 folder which should be already entered by default
3.  Right-click a FLAC playlist file and choose Convert->quick convert
4.  From the Quick Convert list, choose Opus and hit the "edit" button below
5.  In the Preset dialog that comes up, move the slider/drop boxes to the values you want, hit "OK", then "Convert"
6.  Pick where you want the file saved to and hit "Save"--the conversion to Opus will proceed.

If this works fine, you know you have a good opusenc.exe.  If you still want to change converter paths, add options, etc those results are on you.

Re: Opus conversion failure (Code -1073741502)

Reply #10
Yeah, seems I was a bit hasty with my "problem solved". I momentarily forgot that when I was playing around with the custom decoder settings, I had set the path to some old opusenc.exe file (libopus 1.3, libopusenc 0.2.1) that was in the installation directory of an old version of dbPoweramp which I never got around to paying for an update. So that old one seems to be working but not the one in the f2K folder.

When  I set the custom decoder path back to the encoder from the Free Encoder Pack in the f2K installation folder, it fails again. Back to square one. I am completely stumped.
1.  Delete any "opusenc.exe" in Foobar/encoders or elsewhere
2.  Re-install the Free Encoder Pack and don't change any paths; point the Destination Folder to your main Foobar2000 folder which should be already entered by default
3.  Right-click a FLAC playlist file and choose Convert->quick convert
4.  From the Quick Convert list, choose Opus and hit the "edit" button below
5.  In the Preset dialog that comes up, move the slider/drop boxes to the values you want, hit "OK", then "Convert"
6.  Pick where you want the file saved to and hit "Save"--the conversion to Opus will proceed.

If this works fine, you know you have a good opusenc.exe.  If you still want to change converter paths, add options, etc those results are on you.

Ran through all the steps to the letter... same problem as before: "An error occurred while writing to file (The encoder has terminated prematurely with code -1073741502 (0xC0000142); please re-check parameters)".

By the way, before I started tweaking and changing paths, my f2k installation was brand new and installed to the default paths, including the Free Encoder Pack.

Re: Opus conversion failure (Code -1073741502)

Reply #11
Issue resolved (for real this time)!!

I uninstalled f2k 64-bit and then installed the 32-bit version. And the default Opus encoder from the Free Encoder Pack is now working without any issues.

Thank you to everyone who provided input and tried to assist with resolving.

Re: Opus conversion failure (Code -1073741502)

Reply #12
So, it seems 64 bit opusenc.exe from Free Encoder Pack isn't working on your system.

Re: Opus conversion failure (Code -1073741502)

Reply #13
The opusenc binaries bundled in Free Encoder Pack do not depend on any external DLLs that would cause the issue.

But I believe I have found the culprit: Comodo Antivirus. With default settings everything works as should, but enabling HIPS allows everything to break. For example preventing opusenc from accessing conhost causes the very error message from this topic's title.

 

Re: Opus conversion failure (Code -1073741502)

Reply #14
The opusenc binaries bundled in Free Encoder Pack do not depend on any external DLLs that would cause the issue.

But I believe I have found the culprit: Comodo Antivirus. With default settings everything works as should, but enabling HIPS allows everything to break. For example preventing opusenc from accessing conhost causes the very error message from this topic's title.

I use Comodo, but not the Antivirus, rather Comodo Antivirus. But is also has HIPS enabled.

Re: Opus conversion failure (Code -1073741502)

Reply #15
The opusenc binaries bundled in Free Encoder Pack do not depend on any external DLLs that would cause the issue.

But I believe I have found the culprit: Comodo Antivirus. With default settings everything works as should, but enabling HIPS allows everything to break. For example preventing opusenc from accessing conhost causes the very error message from this topic's title.

I use Comodo, but not the Antivirus, rather Comodo Antivirus. But is also has HIPS enabled.

Sorry, I meant that I use Comodo Firewall.