4

I use the static binaries of ffmpeg (http://johnvansickle.com/ffmpeg/) on linux mint 17.2. When I try to capture audio with the command:

ffmpeg -f alsa -ac 2 -i hw:0 output.wav

I end up with the following error:

ALSA lib ../../src/conf.c:3325:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so
ALSA lib ../../../src/pcm/pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM hw:0
[alsa @ 0x43e7200] cannot open audio device hw:0 (No such file or directory)
hw:0: Input/output error

Following the suggestions from other sources I reinstalled the following packages successfully (since they were already installed), but ended up with the same error:

sudo apt-get install --reinstall libasound2:amd64 libasound2-plugins:amd64
sudo apt-get install --reinstall libasound2:i386 libasound2-plugins:i386

I can successfully use aplay (I don't know if it is of any concern):

aplay /usr/share/sounds/alsa/Front_Center.wav

And I know for a fact that libasound_module_conf_pulse.so and friends are located on my pc, and located here:

/usr/lib/i386-linux-gnu/alsa-lib/libasound_module_conf_pulse.so
/usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_conf_pulse.so

So what can be the problem? I just wanted to do a simple screen capture and by now my day is gone :(. I do find it strange that the ffmpeg error spits out a relative path ../../src/conf.c:3325 (is that of any concern?).

4
  • I just installed avconv (sudo apt-get install libav-tools) and was able to run with avconv (avconv -f alsa -ac 2 -i hw:0 output.wav). So the problem is probably with the static build of ffmpeg. I dislike avconv, but will use it as an alternative in this case. Jan 10, 2016 at 14:44
  • Is there a conf file in /etc/ld.so.conf.d/ that links to /usr/lib/i386-linux-gnu/alsa-lib/ ? If not, you may want to add it and run ldconfig (as root). Also, if you're using the 64bit release of ffmpeg, replace i386 by x86_64.
    – Ely
    Jan 11, 2016 at 13:30
  • @Ely, thanks, I now added a file alsa-lib.conf with content /usr/lib/x86_64-linux-gnu/alsa-lib/ and ran sudo ldconfig, but the same problem still persists. Jan 13, 2016 at 11:39
  • Yikes, sorry then I'm out of ideas. Looks like incompatibility between the lib that ffmpeg was linked against and the one installed on your system. Someone with more linux knowledge might be able to help you out..
    – Ely
    Jan 13, 2016 at 16:31

2 Answers 2

5

These are fully static builds and due to this they have no dependency with system shared libraries, so it's useless to adjust something in the system. Unfortunately they are not build against pulse. It means that in the way they are provided you cannot record audio with pulse/alsa, unless the author adds pulse support in next versions of these builds.

An alternative solution would be to make your own build. It's not that hard. There is a simple guide at FFmpeg webiste: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu . Add "--enable-libpulse" to FFmpeg configure script in the final step.

1
  • I had a similar problem on a Raspberry Pi, and simply did this to solve it: sudo ln -s /usr/lib/arm-linux-gnueabihf/alsa-lib /usr/lib/alsa-lib Thoughts?
    – Brad
    Feb 1, 2022 at 4:14
1
+100

This same error is treated in the Ask Ubuntu post
Unable to open shared libasound library, despite file existing.

I reproduce below the answer that perhaps has the best chance of solving the problem:

First create the called environment given in the Error:

In my case: ALSA lib conf.c:3725:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so (/lib/i386-linux-gnu/alsa-lib/libasound_module_conf_pulse*.so: cannot open shared object file: No such file or directory) ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default

Run these commands:

sudo mkdir /usr/lib/i386-linux-gnu/alsa-lib/
cd /usr/lib/i386-linux-gnu/alsa-lib/
sudo dpkg --add-architecture i386
sudo apt-get install libasound2-plugins:i386

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .