Path problems when trying to export with an external program

Ubuntu 19.04
Audacity 2.3.2

Hello. :slight_smile:

I am using Audacity and trying to export files with an external program, but Audacity seems to not be able to find my command, even when I double checked it was installed on the system (and I can access it on the command line), and whether I use the short command name or the full path to it.
For example, I want to export using opusenc, so in Audacity export window I try either :

opusenc --bitrate 64 -  "%f"


/usr/bin/opusenc --bitrate 64 -  "%f"

…and in both cases get the following error

execvp(/usr/bin/opusenc, --bitrate, 64, -, /path/to/myfile.opus) failed with error 2!

However when I do this in the command line it works :

$ /usr/bin/opusenc --bitrate 64 - /path/to/myfile.opus </path/to/myfile.wav

And I know that opusenc is really in /usr/bin, because :

$ which opusenc
$ ls -l /usr/bin/opusenc
-rwxr-xr-x 1 root root 89728 janv. 23  2017 /usr/bin/opusenc

BUT when I try to browse to find the command manually in the Audacity window, the opusenc executable is not visible in /usr/bin, which I don’t understand :
So it looks like the command exists but Audacity can’t see it ? :confused:
I also tried with other commands like lame or ffmpeg but got the same result, so I am puzzled.

Thanks in advance.

Does opusenc encode for you from the command line (in a Terminal)?

Your input and output file names appear to be the wrong way round :confused:

This works for me on Ubuntu 18.04. The file “sample.wav” is on my Desktop.

cd ~/Desktop
opusenc sample.wav out.opus

And both of these work for me in Audacity (file name set to “testfile.opus”)

opusenc - "%f"

opusenc --bitrate 64 - "%f"

Yeah, on the command line it works in both cases, whether I use :

$ opusenc myfile.wav out.opus

Or :

$ opusenc - out.opus <myfile.wav

I was just using the second command format as then it goes through opusenc standard input (as is how I suppose Audacity passes the audio data to the user-submitted command, so it is the “closest” to what Audacity does).

I re-tried again to save the file in Audacity with

opusenc - "%f"

and am still getting the same error.

However, I just tried to copy /usr/bin/opusenc to my home folder, then saved the file with Audacity using :

/home/jonn/opusenc - "%f"

And it worked like a charm. :confused:
This is really strange. Could it be some kind of permission problem, ie for some reason Audacity cannot see or access files in /usr/bin but can access files inside my home folder ?

Audacity should be running with your normal user permissions, so if you can see opusenc, then Audacity should be able to see it too.
How are you launching Audacity?

From the Ubuntu “universal” search bar (I don’t know what’s its official name).
I also tried to launch Audacity from the command line, but got the same result (ie. I get the same error when I try to access /usr/bin/opusenc or opusenc, but it works when I use /home/jonn/opusenc). I am puzzled.

Also, I don’t know if it may be related, but each time I open the “Export audio” window, I get the following warning (if I have launched Audacity in a terminal) :

(audacity:11812): GLib-GIO-WARNING **: 20:04:11.769: Error creating IO channel for /proc/self/mountinfo: Permission denied (g-file-error-quark, 2)

Are you using a Snapcraft or Flatpak version of Audacity?

Now that you say it, it seems to be a Snapcraft package (“which audacity” gives /snap/bin/audacity). -_-
I just installed Audacity via the Ubuntu GUI Software center, and now after re-opening the Software center, it effectively states that the “source” for the Audacity package is “Boutique des snap” which I think means it comes from some Snapcraft repository somewhere, but I did not notice that when I installed it at first.

That’ll be the problem. Those types of packages are sandboxed, which prevents them from accessing external libraries.
If you uninstall that version, and install the standard repository version, then it should work as expected.

Unless you’ve done anything strange with your list of software sources, Audacity can be installed very easily from the command line (in a Terminal window):

sudo apt install audacity

and follow the on-screen prompts.

Yeah, I just did that (after uninstalling the Snapcraft version), and it works like a charm !
I just did not know until now that the Ubuntu Software center had different versions than those you get from the standard Ubuntu packages (actually I thought it was just a frontend for Apt, that I sometimes use when I am lazy…).
Anyway thank you very much for your help. :slight_smile: