我试图使用 FFmpeg 从服务器上的应用程序录制音频。显然,我需要一个 Alsa 环回驱动程序。我读到这应该可以在 Ubuntu 14.04 上运行:
modprobe snd-aloop
不幸的是,我的内核不支持这个功能:
modprobe:严重错误:未找到模块 snd-aloop。
这是 Ubuntu 服务器和桌面发行版之间的区别吗?
我如何安装该驱动程序?
谷歌搜索让我找到了这里: https://wiki.ubuntu.com/Audio/InstallingLinuxAlsaDriverModules
然后该页面说我需要去这里: https://wiki.ubuntu.com/Audio/UpgradingAlsa
该页面明智地建议使用 DKMS: https://wiki.ubuntu.com/Audio/UpgradingAlsa/DKMS
但是,DKMS 说明仅列出了英特尔驱动程序: https://code.launchpad.net/~ubuntu-audio-dev/+archive/ubuntu/alsa-daily/+packages
我是否遗漏了什么?
答案1
好吧,我可以尝试在 Ubuntu 16.04 桌面版(VirtualBox 禁用了声卡)中加载它。如您所见,它已安装
linux-image-extra
您可能尚未安装的软件包。~$ modinfo snd-aloop filename: /lib/modules/4.4.0-42-generic/kernel/sound/drivers/snd-aloop.ko license: GPL description: A loopback soundcard author: Jaroslav Kysela <[email protected]> srcversion: 0A4CE16C028DAB4BC8260D3 depends: snd-pcm,snd intree: Y vermagic: 4.4.0-42-generic SMP mod_unload modversions parm: index:Index value for loopback soundcard. (array of int) parm: id:ID string for loopback soundcard. (array of charp) parm: enable:Enable this loopback soundcard. (array of bool) parm: pcm_substreams:PCM substreams # (1-8) for loopback driver. (array of int) parm: pcm_notify:Break capture when PCM format/rate/channels changes. (array of int) ~$ dpkg -S /lib/modules/4.4.0-42-generic/kernel/sound/drivers/snd-aloop.ko linux-image-extra-4.4.0-42-generic: /lib/modules/4.4.0-42-generic/kernel/sound/drivers/snd-aloop.ko ~$ sudo modprobe snd-aloop ~$ alsa-info.sh --stdout upload=true&script=true&cardinfo= !!################################ !!ALSA Information Script v 0.4.64 !!################################ !!Script ran on: Thu Mar 23 10:28:23 UTC 2017 !!Linux Distribution !!------------------ Ubuntu 16.04 LTS \n \l DISTRIB_ID=Ubuntu DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS" NAME="Ubuntu" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 16.04 LTS" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" UBUNTU_CODENAME=xenial !!DMI Information !!--------------- Manufacturer: innotek GmbH Product Name: VirtualBox Product Version: 1.2 Firmware Version: VirtualBox !!Kernel Information !!------------------ Kernel release: 4.4.0-42-generic Operating System: GNU/Linux Architecture: x86_64 Processor: x86_64 SMP Enabled: Yes !!ALSA Version !!------------ Driver version: k4.4.0-42-generic Library version: 1.1.0 Utilities version: 1.1.0 !!Loaded ALSA modules !!------------------- snd_aloop !!Sound Servers on this system !!---------------------------- Pulseaudio: Installed - Yes (/usr/bin/pulseaudio) Running - Yes !!Soundcards recognised by ALSA !!----------------------------- 0 [Loopback ]: Loopback - Loopback Loopback 1 !!PCI Soundcards installed in the system !!-------------------------------------- !!Advanced information - PCI Vendor/Device/Subsystem ID's !!------------------------------------------------------- !!Modprobe options (Sound related) !!-------------------------------- snd_pcsp: index=-2 snd_usb_audio: index=-2 snd_atiixp_modem: index=-2 snd_intel8x0m: index=-2 snd_via82xx_modem: index=-2 snd_atiixp_modem: index=-2 snd_intel8x0m: index=-2 snd_via82xx_modem: index=-2 snd_usb_audio: index=-2 snd_usb_caiaq: index=-2 snd_usb_ua101: index=-2 snd_usb_us122l: index=-2 snd_usb_usx2y: index=-2 snd_cmipci: mpu_port=0x330 fm_port=0x388 snd_pcsp: index=-2 snd_usb_audio: index=-2 !!Loaded sound module options !!--------------------------- !!Module: snd_aloop enable : Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N id : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null) index : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 pcm_notify : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 pcm_substreams : 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 !!ALSA Device nodes !!----------------- crw-rw----+ 1 root audio 116, 2 Mar 23 11:18 /dev/snd/controlC0 crw-rw----+ 1 root audio 116, 4 Mar 23 11:18 /dev/snd/pcmC0D0c crw-rw----+ 1 root audio 116, 3 Mar 23 11:18 /dev/snd/pcmC0D0p crw-rw----+ 1 root audio 116, 6 Mar 23 11:18 /dev/snd/pcmC0D1c crw-rw----+ 1 root audio 116, 5 Mar 23 11:18 /dev/snd/pcmC0D1p crw-rw----+ 1 root audio 116, 1 Mar 23 11:18 /dev/snd/seq crw-rw----+ 1 root audio 116, 33 Mar 23 11:18 /dev/snd/timer /dev/snd/by-path: total 0 drwxr-xr-x 2 root root 60 Mar 23 11:18 . drwxr-xr-x 3 root root 200 Mar 23 11:18 .. lrwxrwxrwx 1 root root 12 Mar 23 11:18 platform-snd_aloop.0 -> ../controlC0 !!Aplay/Arecord output !!-------------------- APLAY **** List of PLAYBACK Hardware Devices **** card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 ARECORD **** List of CAPTURE Hardware Devices **** card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 !!Amixer output !!------------- !!-------Mixer controls for card 0 [Loopback] Card hw:0 'Loopback'/'Loopback 1' Mixer name : 'Loopback Mixer' Components : '' Controls : 97 Simple ctrls : 1 Simple mixer control 'PCM',0 Capabilities: pvolume Playback channels: Front Left - Front Right Limits: Playback 0 - 255 Mono: Front Left: Playback 255 [100%] [0.00dB] Front Right: Playback 255 [100%] [0.00dB] ...
对于一般的解决方案,请查看:
刚刚检查了全新的 Ubuntu 16.04.1 服务器。它有模块
snd-aloop
。linux-image-extra*
软件包作为元软件包的依赖项安装,linux-image-generic
而元软件包也是linux-generic
元软件包的依赖项。因此,快速修复:sudo apt install linux-generic
答案2
SK Venkat 的这个答案对我有用。唯一的问题是 ls 命令必须在文件夹上运行:/lib/modules/$(uname -r)/kernel/sound/drivers
他漏掉了 drivers 末尾的 s。没有足够的代表来发表评论,因此在这里添加答案。
ls 没有显示 snd-aloop。正如他所建议的,下面的命令可以解决问题。
sudo apt install linux-modules-extra-$(uname -r)
sudo reboot
答案3
如果ls /lib/modules/$(uname -r)/kernel/sound/drivers
没有列出,snd-aloop.ko
则尝试以下命令来安装附加模块:
$ sudo apt install linux-modules-extra-$(uname -r)
$ sudo reboot
由于云提供商的 Linux 发行版默认没有某些模块,因此需要根据需要将其添加到我们的系统中。
重新启动后,尝试上面提到的相同 ls 命令,您将看到该snd-aloop.ko
文件。
答案4
你能运行这个吗
alsactl restore -P
如果不能,你可以尝试安装
Ubuntu 服务器:安装 Alsa 声音和 MOC (Music On Console)
如果无法从 APT 安装,您可以尝试从源代码编译,按照这里
如果没有其他方法,我建议阅读这个: