BtbN / FFmpeg-Builds

MIT License
7.43k stars 1.02k forks source link

Do this builds support ALSA ? #273

Closed pulento closed 1 year ago

pulento commented 1 year ago

Using last build shared GPL and LGL they seems to not support ALSA:

/usr/local/bin/ffmpeg -f alsa -i hw:1
ffmpeg version N-110553-g5b300b69a6-20230510 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.152_89671bf)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-version3 --disable-debug --enable-shared --disable-static --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-openssl --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --disable-avisynth --enable-chromaprint --enable-libdav1d --disable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --disable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --disable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --disable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --disable-libx264 --disable-libx265 --disable-libxavs2 --disable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags='-pie -Wl,-rpath=\$\$ORIGIN -Wl,-rpath=\$\$ORIGIN/../lib' --extra-libs='-ldl -lgomp' --extra-version=20230510
  libavutil      58.  7.100 / 58.  7.100
  libavcodec     60. 11.100 / 60. 11.100
  libavformat    60.  5.100 / 60.  5.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  8.100 /  9.  8.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100

[in#0 @ 0x562d90c9f640] Unknown input format: 'alsa'

Listing formats don't show ALSA either:

/usr/local/bin/ffmpeg -formats
ffmpeg version N-110553-g5b300b69a6-20230510 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.152_89671bf)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-version3 --disable-debug --enable-shared --disable-static --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-openssl --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --disable-avisynth --enable-chromaprint --enable-libdav1d --disable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --disable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --disable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --disable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --disable-libx264 --disable-libx265 --disable-libxavs2 --disable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags='-pie -Wl,-rpath=\$\$ORIGIN -Wl,-rpath=\$\$ORIGIN/../lib' --extra-libs='-ldl -lgomp' --extra-version=20230510
  libavutil      58.  7.100 / 58.  7.100
  libavcodec     60. 11.100 / 60. 11.100
  libavformat    60.  5.100 / 60.  5.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  8.100 /  9.  8.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
File formats:
 D. = Demuxing supported
 .E = Muxing supported
 --
.... cut ....
 DE alaw            PCM A-law
 D  alias_pix       Alias/Wavefront PIX image
 DE alp             LEGO Racers ALP
 DE amr             3GPP AMR
 D  amrnb           raw AMR-NB
 D  amrwb           raw AMR-WB
  E amv             AMV
 D  anm             Deluxe Paint Animation
...cut...

Seeing older bugs reports it seems they used to be compiled with ALSA support, it this deliberately ?

Thanks

BtbN commented 1 year ago

The alsa lib cannot be statically linked(it's just a shim loader for other system libs, without a stable ABI between that shim and those libs), so unfortunately offering alsa in generic static builds is impossible.

pulento commented 1 year ago

If I understand correctly this happens for static and shared releases since ALSA lib are just stubs libraries ?

Can I use your scripts to compile it with ALSA support on my Debian 11 ?

Thanks !

BtbN commented 1 year ago

Not sure what you mean. For example, if you're using pulseaudio, which installs an alsa plugin, which gets loaded by libalsa into every individual application. The ABI the libalsa stub that got statically linked into ffmpeg might be different than the one of the systems libalsa, resulting in erratic runtime behaviour/crashes. It's straight up impossible to statically links a (useful) alsa library that doesn't crash. You CAN link it statically, and include all the default plugins. But that would in turn make it impossible to use any plugins the system might rely in (pulseaudio, pipewire, ...), which is what the vast majority of systems use these days. Plus, I'm not sure if such a fully static setup wouldn't still end up trying to load system plugins, and in turn crash.

So unfortunately, alsa is out of the question for static builds. pulseaudio is supported fine, which also supports pipewire. That should cover almost every modern desktop system.

In theory you could write a custom script.d script for exactly your favourites Distro-alsa-lib version, and link it in a shared fashion. But that's something you will have to cook up yourself, it's not something natively supported.

pulento commented 1 year ago

Got it 👍

I'm not on a desktop but on a server not running X but I think pulseaudio can run anyway as a service so I'll try that first. Thanks