Closed aramg closed 4 years ago
Just tested droidcam-cli and droicam on Fedora 32, it works perfectly with VLC, the only problem, for me, is that I can't find the loopback device in the audio mixer to select it as the default input device, so I can't use it in other programs. Until now for the audio I was using this script that I suppose does a similar thing, but with it I can see and select the loopback device in the audio mixer.
I think it has something to do with how PluseAudio and ALSA interact. Let me see if I can figure it out.
These instructions seem to make a difference, but not sure how reliable it is: https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Microphone
After rebooting the Loopback device became card 0, something to take into account.
To have snd_aloop load after you reboot, add it to /etc/modules-load.d:
sudo bash -c "grep snd_aloop /etc/modules-load.d/droidcam.conf 2>/dev/null || echo snd_aloop >> /etc/modules-load.d/droidcam.conf"
snd_aloop does not persist after rebooting for me after that command, it gives me the error "Audio loopback device not found. Is snd_aloop loaded?"
These instructions seem to make a difference, but not sure how reliable it is: wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Microphone
After rebooting the Loopback device became card 0, something to take into account.
Using those instructions from the ArchWiki and setting device=hw:0,0
with the values given by the DroidCam client (in my case hw:3,1,1
), I can see the microphone as "Built-in Audio" on the Audio Mixer after restarting PulseAudio.
snd_aloop does not persist after rebooting for me after that command, it gives me the error "Audio loopback device not found. Is snd_aloop loaded?"
Did it get added to the file correctly? Check the contents like so:
cat /etc/modules-load.d/droidcam.conf
cat /etc/modules-load.d/droidcam.conf
videodev
v4l2loopback_dc
snd_aloop
Just tested on Manjaro, audio seem works with MS team / VLC. Just noted that after restart the output
aplay -l **** 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 ..... card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 ....
using vlc seems to work, but that's the only one. chrome (e.g. testing via https://addpipe.com/simple-web-audio-recorder-demo/) or various videochats does not work. I think it might be pulseaudio related.
> pactl list short sources | grep snd_aloop
6 alsa_output.platform-snd_aloop.0.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
7 alsa_input.platform-snd_aloop.0.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
Rather than creating an alsa device, is it possible to add the Android phone as a native pulseaudio device (if that's a meaningful question)?
You can see this beta working as hw:1,1,0
, but it does not appear as an input device in pavucontrol
:
So I have no way to control the volume with the pulseaudio volume control. I don't know if modern desktop environments rely on pulseaudio for their volume controls, e.g. gnome's volume control.
I have succeeded with the VLC sound test. Ubuntu/Mint 19.3 on leeetle tiny hardware :D a Fitlet 4 fanless server. It's a new installation and I've got other sound troubles so right now I can only hear through a bluetooth headset (droidcam is connected over wifi) so I'll be back in a couple of days, but my goal is to get it working with Zoom. At the moment I also cannot see a microphone device and Zoom doesn't register any sound input with any of the devices it knows about. I'll be going through the steps in the comments above and keep you posted, but I thought you'd be interested to hear of another success. Thanks for implementing!
Thanks for the feedback so far. I still need to try and figure out how PulseAudio plugins work and if we can have a proper virtual "DroidCam Microphone" that sits on top of the loopback card.
Hey, thanks for support. I was experimenting with lg g2 Android usb midi support and have this. When connecting the phone via usb choose MIDI or something to do with sound instead of file transfer. Maybe it will be of any use. Otherwise the pulseaudio irc channel is very nice, they helped me a lot:
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index57h3
pactl list sinks short
pactl list sources short
pactl load-module module-loopback source=alsa_input.usb-lge_LG-D802_03ade7d98f55a661-00.iec958-stereo
parec --raw your signal on your phone, pipe it through to ssh your-computer paplay --raw
pactl load-module module-loopback source=alsa_input.lge_LG-D802_03ade7d98f55a661-00.iec958-stereo sink=alsa_output.pci-0000_00_1f.3.analog-stereo
pactl load-module module-simple-protocol-tcp rate=48000 format=s16le channels=2 source=alsa_output.pci-0000_00_1f.3.analog-stereo.monitor record=true port=12345 listen=192.168.42.208
https://iriun.com/index.html does use the jack audio server but i was unable to output phone mic sound with it.
I think I got it working on Mint 19.3 Steps:
sudo modprobe snd_aloop
hw:2,1,0
(or similar)/etc/pulse/default.pa
and follow the instruccións in the link above, in this case it was load-module module-alsa-source device=hw:2,1,0
pulseaudio -k
pulseaudio -D (I got an error but it works)
pavucontrol
I can see now a microphone device in Input Devices (you have to remember the name).Issues:
I tried to made the changes permanent, but after rebooting if I launch droidcam the audio device can change, sometimes it will be hw:2,1,0
, sometimes hw:1,1,0
,... I don't know how to fix the numbers of the virtual device so I have to adjust /etc/pulse/default.pa
before connecting.
FYI. you can also name the loopback device:
cat /etc/modprobe.d/droidcam.conf
options v4l2loopback_dc width=640 height=480
options snd-aloop pcm_substreams=1 id=droidcam
then you can look it up by name (makes it also easier to select it in the apps). Right now it prevents the client to find the loopback device though :/
If I run this command, I get input from pulseaudio:
pacmd load-module module-alsa-source device=hw:3,1,0
And sorry for the same solution, did not saw the comments from @guillermoml. Maybe naming the module would let use address in by name, because this works too:
pacmd load-module module-alsa-source device=hw:Loopback,1,0
I'm running Lubuntu 19 (in a VM), and pavucontrol so far has refused to detect any input, even after getting a new device to show up ("Built in Audio").
@ensonic 's commands above are convenient, and alternative to editing /etc/pulse/default.pa. As far as renaming snd_aloop, that sounds interesting (no pun intended) but I'm not sure its the right approach since other apps might want to use the Loopback device as well.
I was able to pin the Loopback card slot by adding options snd-aloop index=1
to /etc/modprobe.d/droidcam.conf
.
I also tried pacmd load-module module-alsa-card device_id=1 card_name=DroidCam
but same results. I'll try pulseaudio irc, hopefully it'll be an easy fix for people that know this stuff.
Here is how you can set the name for pulseaudio:
pacmd load-module module-alsa-source device=hw:Loopback,1,0 source_properties=device.description=droidcam
It did more testing and if I add load the module in /etc/pulse/default.pa, droidcam won't use the input and take the next one on the loopback device. This only work if we start droidcam first and then run the pacmd.
It did more testing and if I add load the module in /etc/pulse/default.pa, droidcam won't use the input and take the next one on the loopback device. This only work if we start droidcam first and then run the pacmd.
I noticed that too, if you run droidcam from the terminal it'll print out the error, "Resource is busy", when trying to open the card.
It's working on Elementary OS. The @guillermoml solution is working as well, pavucontrol shows a "Builtin audio" source and the browsers and applications can pick it up. ElementaryOS's audio settings cannot, but it's working sufficiently well for me.
Thanks @aramg !
It's working with VLC but doesn't work in other places. I followed all the indications above. I'm using ubuntu studio 20.04.
working like a charm here on both linux and linux-ck (arch linux)
I did the same steps as suggested on OP and loaded the module using @ensonic command
pacmd load-module module-alsa-source device=hw:0,1,0
I didn't want to mess with default.pa as already had troubles with it in the past.
For some reason, linux doesn't load the v4l2loopback-dc module, but then I modprobe it manually with no problem. In linux-ck, I have to modprobe --force for it to be loaded, but then no issues.
For sound to be captured on open broadcast studio I needed to insert a capture alsa device and change the device to custom and typing hw:0,1,0 on PCM field.
Now I have a full working cam with audio capture =)
Thanks a lot for this feature!
I use Lubuntu with PulseAudio, I edited /etc/pulse/default.pa and insert a load-module as explained in https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Microphone
It works!
Allright, since the general consensus seems to be 👍 I've merged the code into master and will update the website tomorrow. We'll see if the few instances of PulseAudio not working can get resolved going forward.
https://dev47apps.com/files/linux/droidcam_1590294873.zip MD5 99652f49ca644a6301426066c4656827 commit 41375e2f
Hello!
Sound support has been added to the Linux client, I am looking for some volunteers to test everything out.
Steps:
sudo modprobe snd_aloop
.You should see it listed as a sound card when you type
aplay -l
To have snd_aloop load after you reboot, add it to /etc/modules-load.d:
sudo bash -c "grep snd_aloop /etc/modules-load.d/droidcam.conf 2>/dev/null || echo snd_aloop >> /etc/modules-load.d/droidcam.conf"
https://dev47apps.com/files/linux/droidcam_sound_beta.zip
droidcam
ordroidcam-cli
.Both will try to find the Loopback sound card and open one of the substreams. They will print/show which sound device you should use to get the output.
Connect to the phone app, you should see a "Audio Connected" toast on the phone.
Open for example VLC Player, press Ctrl+C to open a capture device and open the droidcam audio and video devices. eg.
/dev/video1
andhw:1,1,0
. Start playing VLC, you should get both sound and picture. If you dont hear anything check the "Audio Device" option in the VLC file menu on top, make sure its set to your speakers.