You are not logged in.

#1 2022-09-28 09:39:54

ignuthat
Member
Registered: 2022-03-23
Posts: 20

ffmpeg can't grab/record audio: Generic error in external library

Hi there!

I use ffmpeg to record audio files occasionally. I haven't used this functionality for over a month, so I don't know how long this has been broken for. My audio works completely fine otherwise. I can even record audio with OBS!

The command I use for recording with ffmpeg is the following:

ffmpeg -nostdin -f pulse -i "alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink" -ac 2 -ab 64k test-audio.mp3

The output:

ffmpeg version n5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, pulse, from 'alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink':
  Duration: N/A, bitrate: 1536 kb/s
  Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> mp3 (libmp3lame))
alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink: Generic error in an external library
Output #0, mp3, to 'test-audio.mp3':
  Metadata:
    TSSE            : Lavf59.27.100
  Stream #0:0: Audio: mp3, 48000 Hz, stereo, s16p
    Metadata:
      encoder         : Lavc59.37.100 libmp3lame
size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

While I primarily use this on my Sway/Wayland/Pipewire/Wireplumber system, I have also tried this on my X11/GNOME/Pipewire/Wireplumber system with the same error message.

I've also tried:

systemctl --user status wireplumber

Which results in:

Sep 28 16:34:52 archsys wireplumber[650]: dbus[650]: Attempted to unregister path (path[0] = MediaEndpoint path[1] = A2DPSink) which isn't registered
Sep 28 16:34:52 archsys wireplumber[650]: dbus[650]: Attempted to unregister path (path[0] = MediaEndpoint path[1] = A2DPSink) which isn't registered
Sep 28 16:34:52 archsys wireplumber[650]: dbus[650]: Attempted to unregister path (path[0] = MediaEndpoint path[1] = A2DPSink) which isn't registered
Sep 28 16:34:52 archsys wireplumber[650]: dbus[650]: Attempted to unregister path (path[0] = MediaEndpoint path[1] = A2DPSink) which isn't registered

Not sure where to go from here.

Offline

#2 2022-09-30 20:44:44

ssnf
Member
Registered: 2022-09-30
Posts: 1

Re: ffmpeg can't grab/record audio: Generic error in external library

Can confirm this issue.

Solved it by getting rid of pipewire and reinstalling pulse.

I honestly don't get the hype around pipewire, it sucks, it's bad software just as much as alsa and pulse. If not even more, given that at least pulse and alsa work... sort of.

I might just end up using sndio or switching entirely to OpenBSD for my desktop anyway, I'm tired of the whole audio crap on Linux that has been going on for way too long already.

Offline

#3 2022-10-01 01:31:36

ignuthat
Member
Registered: 2022-03-23
Posts: 20

Re: ffmpeg can't grab/record audio: Generic error in external library

If only I could get rid of Pipewire on Sway...if I did that, I won't be able to do any screen recording with OBS, because the portals use Pipewire to capture the screen. I don't really want to go back to GNOME/X11.

It was only a few months ago that whole Pipewire-Media-Session/Wireplumber transition happened, and I don't relish transitioning back. I still have no idea why OBS manages to record audio but ffmpeg can't...

Offline

#4 2022-10-01 02:45:59

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: ffmpeg can't grab/record audio: Generic error in external library

FYI, there is screencorder though I've never used it myself.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2022-10-01 10:30:23

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,935

Re: ffmpeg can't grab/record audio: Generic error in external library

It's a bug in pipewire https://gitlab.freedesktop.org/pipewire … ssues/2711 that got fixed and will be part of the next release.

Offline

#6 2022-10-01 12:03:03

ignuthat
Member
Registered: 2022-03-23
Posts: 20

Re: ffmpeg can't grab/record audio: Generic error in external library

Thanks, V1del. I was quite convinced it was Wireplumber.

Trilby, thanks for the recommendation, although this doesn't fit my use case. From the looks of it, it only records video + audio, not solely audio. FFmpeg is the only user-facing tool that can do that, as far as I'm aware. My use case is getting audio files into Anki cards via ames for those interested. Not a dealbreaker without it for now, but happy to hear the next Pipewire release fixes this.

Offline

#7 2022-10-01 12:16:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: ffmpeg can't grab/record audio: Generic error in external library

What?  You said you were doing screen recording with OBS.  If you are not taking video but only audio, then the fact that you are running wayland is irrelevant so pipewire should not be needed - if it's getting int the way, get rid of it.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2022-10-01 14:44:08

ignuthat
Member
Registered: 2022-03-23
Posts: 20

Re: ffmpeg can't grab/record audio: Generic error in external library

I do both. I use ames for recording solely audio for my anki cards, and OBS for (admittedly rarer) screen recordings for work.

If I went back to pulseaudio, I'd solve my Anki issue now but be unable to do any screen recording with OBS when the occasion arises.

Last edited by ignuthat (2022-10-01 14:44:16)

Offline

Board footer

Powered by FluxBB