I am trying to use my smartphone as a webcam and microphone in my computer. I use DroidCamX as the server (android) and DroidCam as the client (computer). These successfully connect. Video is correctly working, but audio does not work.
My computer uses KDE Plasma, Pipewire and ArchLinux. By following the direct instructions from DroidCam (https://github.com/dev47apps/droidcam-linux-client?tab=readme-ov-file#sound) (using pactl instead of pacmd), it does not work. I troubleshooted the problem trying to go from bottom to top.
First, DroidCam computer app says it uses the alsa device "hw:0,1,0" (it is on the gui of the application). Thus, I can directly use ALSA to confirm the microphone works by using the following command:
arecord -D hw:0,1,0 -c1 -r48000 -f S16_LE test.wav
This generates a file test.wav with my voice, so the microphone is correctly captured by DroidCam android app, transmitted and received by DroidCam computer application.
The next step is to check if a Loopback device is correctly created, so I execute the command pactl list sources, which generates the following output (the relevant source is shown, but many others are present).
Source #446 State: SUSPENDED Name: alsa_input.platform-snd_aloop.0.pro-input-1 Description: Loopback Pro 1 Driver: PipeWire Sample Specification: float32le 32ch 48000Hz Channel Map: aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7,aux8,aux9,aux10,aux11,aux12,aux13,aux14,aux15,aux16,aux17,aux18,aux19,aux20,aux21,aux22,aux23,aux24,aux25,aux26,aux27,aux28,aux29,aux30,aux31 Owner Module: 4294967295 Mute: no Volume: aux0: 65536 / 100% / 0.00 dB, aux1: 0 / 0% / -inf dB, aux2: 0 / 0% / -inf dB, aux3: 0 / 0% / -inf dB, aux4: 0 / 0% / -inf dB, aux5: 0 / 0% / -inf dB, aux6: 0 / 0% / -inf dB, aux7: 0 / 0% / -inf dB, aux8: 0 / 0% / -inf dB, aux9: 0 / 0% / -inf dB, aux10: 0 / 0% / -inf dB, aux11: 0 / 0% / -inf dB, aux12: 0 / 0% / -inf dB, aux13: 0 / 0% / -inf dB, aux14: 0 / 0% / -inf dB, aux15: 0 / 0% / -inf dB, aux16: 0 / 0% / -inf dB, aux17: 0 / 0% / -inf dB, aux18: 0 / 0% / -inf dB, aux19: 0 / 0% / -inf dB, aux20: 0 / 0% / -inf dB, aux21: 0 / 0% / -inf dB, aux22: 0 / 0% / -inf dB, aux23: 0 / 0% / -inf dB, aux24: 0 / 0% / -inf dB, aux25: 0 / 0% / -inf dB, aux26: 0 / 0% / -inf dB, aux27: 0 / 0% / -inf dB, aux28: 0 / 0% / -inf dB, aux29: 0 / 0% / -inf dB, aux30: 0 / 0% / -inf dB, aux31: 0 / 0% / -inf dB balance 0.00 Base Volume: 65536 / 100% / 0.00 dB Monitor of Sink: n/a Latency: 0 usec, configured 0 usec Flags: HARDWARE DECIBEL_VOLUME LATENCY Properties: alsa.card = "0" alsa.card_name = "Loopback" alsa.class = "generic" alsa.device = "1" alsa.driver_name = "snd_aloop" alsa.id = "Loopback PCM" alsa.long_card_name = "Loopback 1" alsa.mixer_name = "Loopback Mixer" alsa.name = "Loopback PCM" alsa.resolution_bits = "32" alsa.subclass = "generic-mix" alsa.subdevice = "0" alsa.subdevice_name = "subdevice #0" alsa.sync.id = "00000000:00000000:00000000:00000000" api.alsa.card.longname = "Loopback 1" api.alsa.card.name = "Loopback" api.alsa.path = "hw:0,1" api.alsa.pcm.card = "0" api.alsa.pcm.stream = "capture" audio.channels = "32" audio.position = "AUX0,AUX1,AUX2,AUX3,AUX4,AUX5,AUX6,AUX7,AUX8,AUX9,AUX10,AUX11,AUX12,AUX13,AUX14,AUX15,AUX16,AUX17,AUX18,AUX19,AUX20,AUX21,AUX22,AUX23,AUX24,AUX25,AUX26,AUX27,AUX28,AUX29,AUX30,AUX31" card.profile.device = "4" clock.name = "api.alsa.0" device.api = "alsa" device.class = "sound" device.icon_name = "audio-card-analog" device.id = "95" device.profile.description = "Pro 1" device.profile.name = "pro-input-1" device.profile.pro = "true" device.routes = "0" factory.name = "api.alsa.pcm.source" media.class = "Audio/Source" device.description = "Loopback" node.name = "alsa_input.platform-snd_aloop.0.pro-input-1" node.nick = "Loopback PCM" node.pause-on-idle = "false" object.path = "alsa:acp:Loopback:4:capture" port.group = "capture" priority.driver = "2228" priority.session = "2228" factory.id = "19" clock.quantum-limit = "8192" client.id = "41" node.driver = "true" node.loop.name = "data-loop.0" library.name = "audioconvert/libspa-audioconvert" object.id = "267" object.serial = "446" api.acp.auto-port = "false" api.acp.auto-profile = "false" api.alsa.card = "0" api.alsa.split-enable = "true" api.alsa.use-acp = "true" api.dbus.ReserveDevice1 = "Audio0" api.dbus.ReserveDevice1.Priority = "-20" device.bus_path = "platform-snd_aloop.0" device.enum.api = "udev" device.form_factor = "internal" device.name = "alsa_card.platform-snd_aloop.0" device.nick = "Loopback" device.plugged.usec = "696562979" device.subsystem = "sound" sysfs.path = "/devices/platform/snd_aloop.0/sound/card0" spa.object.id = "2" device.string = "0" Formats: pcm
This confirms there is a source recognized by PipeWire called 'Loopback Pro 1'. This source is connected to the alsa device 0,1,0 (alsa.card = "0" alsa.device = "1" alsa.subdevice = "0"). However, no sound is coming from 'Loopback Pro 1' (it is displayed at the volume control of KDE Plasma). I tried both using OBS Studio and Discord.
As a remark, the source information shows that there are 32 active channels. However, the microphone is monochannel. If I try to launch the command arecord -D hw:0,1,0 -c32 -r48000 -f S16_LE test.wav, it generates the output arecord: set_params:1398: Channels count non available.
As a reference, I already reviewed and discarded solutions proposed in Internet, as they mainly focuses on the documentation of DroidCam.
Any help would be very appreciated.