A script that used to work but now doesn't

I have a script that someone from the old forum wrote for me to convert flac files to opus files. It used to work a month or two ago but now I am getting an error. Here is the script:

#!/usr/bin/env bash

find . -type f -name “.flac" | while IFS= read -r filename; do
echo Converting $filename
/bin/opusenc --bitrate 96 “${filename}” "${filename%.
}.opus” && rm “${filename}”

Here is the error it is giving. The number before the segmentation fault is different for each flac it tries to convert. Any help would be appreciated.

/usr/bin/fto: line 7: 83318 Segmentation fault (core dumped) /bin/opusenc --bitrate 96 “${filename}” “${filename%.*}.opus”

The encoder is generating the segfault.

If it has been added to the system using a custom package - you will likely be able to solve this by rebuilding the package.

It looks like the encoder is looking for libflac.so.8 and that file isn’t in /usr/lib. I think there was an update to the flac package maybe and it got changed. I’m not sure.

That’s not correct either though because I see libflac.so.8 in /usr/lib.

Hi @peaveyman,

I take it opusenc is installed?

Check with:

pamac search opusenc

If installed it’ll show an [Installed] flag. If not, the version from the community repository can be installed with:

pamac install libopusenc

Alternatively, you can install the AUR version:

pamac build libopusenc-git

If it is installed from the community repository, reinstall it with:

pamac reinstall libopusenc

Or if you have the AUR version installed, rebuild/reinstall it with:

pamac build libopusenc-git

Hope this helps!

Yes, opusenc is installed. I reinstalled it using the method you described. I had already reinstalled it using pacui. I still get the same segfault.

Hi, you can also do this with ffmpeg (I think it’s installed by default):

ffmpeg -i input.flac output.opus
1 Like

In that case:


Where did you download/install this from?

I second what @oguere proposed: use ffmpeg

1 Like

opusenc is part of the opus-tools package

I’d rather use that than some AUR package or a git version.
It’s just easier …

A repo package producing segfaults is unusual - is your system fully updated?

I triple the suggestion to use ffmpeg instead.

opusenc is severely limited. :-1:

It only supports the following input file formats:

Not MP3? Not AAC/MP4? I’ll pass. FFmpeg is way superior.

I’m not exactly sure how to use ffmpeg but I will give it a shot.

It’s seems my problem is solved. For some reason that I do not know, opus-tools was not on my system. I installed it and the script is working as expected.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.