PyAV cannot find ALSA container on Debian 11
Created by: W3AXL
Overview
When attempting to use PyAV and an ASLA input device on Debian 11, PyAV claims there is no input container named alsa
despite my ffmpeg installation being able to capture from the ALSA device without any issues.
Expected behavior
>>> import av
>>> container = av.open('mic1',format='alsa')
(container opens successfully)
Actual behavior
>>> import av
>>> container = av.open('mic1',format='alsa')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "av/container/core.pyx", line 355, in av.container.core.open
File "av/container/core.pyx", line 132, in av.container.core.Container.__cinit__
File "av/format.pyx", line 90, in av.format.ContainerFormat.__cinit__
ValueError: no container format 'alsa'
Investigation
My FFMPEG installation appears to handle the ALSA device just fine, so I'm not sure why PyAV doesn't recognize ALSA as a valid container.
Below is the console log for a successful FFPMEG recording of the audio from the mic1
device:
$ ffmpeg -f alsa -i 'mic1' output.wav
ffmpeg version 4.3.3-0+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'mic1':
Duration: N/A, start: 1648350240.490388, 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) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'output.wav':
Metadata:
ISFT : Lavf58.45.100
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Metadata:
encoder : Lavc58.91.100 pcm_s16le
size= 372kB time=00:00:02.02 bitrate=1509.2kbits/s speed=0.996x
video:0kB audio:372kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.020458%
Exiting normally, received signal 2.
Reproduction
- Attempt to run
av.open('<device',format='alsa')
Versions
- OS: Debian 11 x64
- PyAV runtime:
PyAV v8.0.3
git origin: git@github.com:PyAV-Org/PyAV
git commit: v8.0.3
library configuration: --disable-doc --disable-static --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-shared --enable-version3 --enable-zlib --prefix=/tmp/vendor
library license: GPL version 3 or later
libavcodec 58. 91.100
libavdevice 58. 10.100
libavfilter 7. 85.100
libavformat 58. 45.100
libavutil 56. 51.100
libswresample 3. 7.100
libswscale 5. 7.100
- PyAV build: N/A (installed via PIP)
- FFmpeg: see above console output